Skip to content

Commit a5f8705

Browse files
added Declined state
1 parent 37af9e6 commit a5f8705

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

modules/gateways/bitpaycheckout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* BitPay Checkout 3.1.1.0
3+
* BitPay Checkout 4.0.1
44
*
55
* Within the module itself, all functions must be prefixed with the module
66
* filename, followed by an underscore, and then the function name. For this
@@ -54,7 +54,7 @@ function bitpaycheckout_MetaData()
5454
{
5555
return array(
5656
'DisplayName' => 'BitPay_Checkout_WHMCS',
57-
'APIVersion' => '3.1.1.0', // Use API Version 1.1
57+
'APIVersion' => '4.0.1', // Use API Version 1.1
5858
'DisableLocalCreditCardInput' => false,
5959
'TokenisedStorage' => false,
6060
);

modules/gateways/bitpaycheckout/bitpaycheckout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* BitPay Checkout 3.1.1.0
3+
* BitPay Checkout 4.0.1
44
*
55
* Within the module itself, all functions must be prefixed with the module
66
* filename, followed by an underscore, and then the function name. For this
@@ -54,7 +54,7 @@ function bitpaycheckout_MetaData()
5454
{
5555
return array(
5656
'DisplayName' => 'BitPay_Checkout_WHMCS',
57-
'APIVersion' => '3.1.1.0', // Use API Version 1.1
57+
'APIVersion' => '4.0.1', // Use API Version 1.1
5858
'DisableLocalCreditCardInput' => false,
5959
'TokenisedStorage' => false,
6060
);

modules/gateways/bitpaycheckout/bitpaycheckout_callback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* BitPay Checkout Callback 3.1.1.0
4+
* BitPay Checkout Callback 4.0.1
55
*
66
* This file demonstrates how a payment gateway callback should be
77
* handled within WHMCS.

modules/gateways/bitpaycheckout/bitpaycheckout_ipn.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* BitPay Checkout IPN 3.1.1.0
3+
* BitPay Checkout IPN 4.0.1
44
*
55
* This file demonstrates how a payment gateway callback should be
66
* handled within WHMCS.
@@ -38,6 +38,7 @@ function checkInvoiceStatus($url){
3838

3939
$all_data = json_decode(file_get_contents("php://input"), true);
4040
$file = 'bitpay.txt';
41+
$err = "bitpay_err.txt";
4142

4243
file_put_contents($file,"===========INCOMING IPN=========================",FILE_APPEND);
4344
file_put_contents($file,date('d.m.Y H:i:s'),FILE_APPEND);
@@ -68,14 +69,12 @@ function checkInvoiceStatus($url){
6869
$result = select_query($table, $fields, $where);
6970
$rowdata = mysql_fetch_array($result);
7071
$btn_id = $rowdata['transaction_id'];
71-
$status_arr = ['confirmed','complete'];
7272

7373
if($btn_id):
7474
switch ($event['name']) {
7575
#complete, update invoice table to Paid
76-
case 'invoice_completed':
76+
case 'invoice_confirmed':
7777

78-
if(in_array($order_status,$status_arr) && $order_status == "complete"):
7978

8079
$table = "tblinvoices";
8180
$update = array("status" => 'Paid','datepaid' => date("Y-m-d H:i:s"));
@@ -84,7 +83,7 @@ function checkInvoiceStatus($url){
8483
update_query($table, $update, $where);
8584
}
8685
catch (Exception $e ){
87-
file_put_contents($file,$e,FILE_APPEND);
86+
file_put_contents($err,$e,FILE_APPEND);
8887
}
8988

9089
#update the bitpay_invoice table
@@ -94,7 +93,7 @@ function checkInvoiceStatus($url){
9493
try{
9594
update_query($table, $update, $where);
9695
}catch (Exception $e ){
97-
file_put_contents($file,$e,FILE_APPEND);
96+
file_put_contents($err,$e,FILE_APPEND);
9897
}
9998

10099
addInvoicePayment(
@@ -104,9 +103,6 @@ function checkInvoiceStatus($url){
104103
0,
105104
'bitpaycheckout'
106105
);
107-
endif;
108-
109-
110106
break;
111107

112108
#processing - put in Payment Pending
@@ -133,6 +129,8 @@ function checkInvoiceStatus($url){
133129

134130
#confirmation error - put in Unpaid
135131
case 'invoice_failedToConfirm':
132+
case 'invoice_declined':
133+
136134
$table = "tblinvoices";
137135
$update = array("status" => 'Unpaid');
138136
$where = array("id" => $orderid, "paymentmethod" => "bitpaycheckout");

0 commit comments

Comments
 (0)