dever 7 лет назад
Родитель
Сommit
acfd777d76
4 измененных файлов с 212 добавлено и 8 удалено
  1. 2 2
      assets/demo.html
  2. 15 5
      assets/sg.js
  3. 1 1
      payment/lib/Payfort.php
  4. 194 0
      payment/sdk/payfort/trace.log

+ 2 - 2
assets/demo.html

@@ -39,8 +39,8 @@ layui.use(['layer', 'form'], function(){
     var $ = layui.$;
     SG.layui = layui;
     SG.id = '#pay';
-    SG.product_name = $("#product_name").val();
-    SG.amount = $("#amount").val();
+    SG.product_name = '#product_name';
+    SG.amount = '#amount';
     SG.Html();
 });
 </script> 

+ 15 - 5
assets/sg.js

@@ -26,8 +26,8 @@ var SG =
 {
     id : '#pay',
     layui : '',
-    product_name : 'test',
-    amount : 1,
+    product_name : '#product_name',
+    amount : '#amount',
     prefix : 'Pay with ',
     submit : 'pay',
     url : host + 'payment/?l=api.get&json=1&callback=?',
@@ -163,12 +163,22 @@ var SG =
     }
     ,Submit : function(key, method)
     {
+        if (location.href.indexOf('?status=') != -1) {
+            var refer = location.href.split('?status=');
+            var refer = refer[0];
+        } else if (location.href.indexOf('&status=') != -1) {
+            var refer = location.href.split('&status=');
+            var refer = refer[0];
+        } else {
+            var refer = location.href;
+        }
+        
         var self = this;
         var param = {};
         param.type = method.id;
-        param.refer = location.href;
-        param.product_name = self.product_name;
-        param.amount = self.amount;
+        param.refer = refer;
+        param.product_name = self.layui.$(self.product_name).val();
+        param.amount = parseInt(self.layui.$(self.amount).val());
         
         self.layui.$.ajax({
            url: self.url, 

+ 1 - 1
payment/lib/Payfort.php

@@ -35,7 +35,7 @@ class Payfort extends Core
             case 2:
                 $name = 'Pay with installments (Redirection)';
                 $method = 'redirection';
-                $currency = '';
+                $currency = 'USD';
                 $command = 'PURCHASE';
                 break;
 

+ 194 - 0
payment/sdk/payfort/trace.log

@@ -6952,3 +6952,197 @@ Array
 )
 
 
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => SAR
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 925438787
+    [customer_email] => test@payfort.com
+    [customer_name] => 
+    [command] => AUTHORIZATION
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [payment_option] => SADAD
+    [signature] => abeafba61d6903f9504c1b6dc414f089691231116c1d015d6eac7670059f62b4
+)
+
+
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => SAR
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 665026794
+    [customer_email] => test@payfort.com
+    [command] => AUTHORIZATION
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [payment_option] => SADAD
+    [signature] => ab040125f58fdb5880b18a1e6baf8eb8967abc1dee21e3e469f5f42833418619
+)
+
+
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => SAR
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 1393784593
+    [command] => AUTHORIZATION
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [payment_option] => SADAD
+    [signature] => ae03431d79160b371701cbfcf0aac7916d0b54263645ad615dcc162f87578c0c
+)
+
+
+========================================================
+
+Fort Redirect Response Parameters 
+Array
+(
+    [r] => processResponse
+    [amount] => 10000
+    [response_code] => 00014
+    [signature] => 88ea9a88745254e71b0fba0f38dd1f5f9a3e392798524d1c23389d10e40162cb
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [payment_option] => SADAD
+    [language] => en
+    [command] => AUTHORIZATION
+    [response_message] => Inactive payment option
+    [merchant_reference] => 1393784593
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [currency] => SAR
+    [status] => 00
+)
+
+
+========================================================
+
+Invalid Signature. Calculated Signature: 88ea9a88745254e71b0fba0f38dd1f5f9a3e392798524d1c23389d10e40162cb, Response Signature: cf5e43a9ee0279979e100cccbba4165d1d09104f8090445007a2a7230f9e9bae
+
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => USD
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 229949005
+    [customer_email] => test@payfort.com
+    [command] => PURCHASE
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [installments] => STANDALONE
+    [signature] => 858ce485df9109dfec22628a03f96b941b70e118f90c8454bec3a395c089c5b7
+)
+
+
+========================================================
+
+Fort Redirect Response Parameters 
+Array
+(
+    [r] => processResponse
+    [amount] => 10000
+    [response_code] => 00093
+    [signature] => eada8ff206dce16458d4d359f6966c9c3d82d99faed71193937a52010f1bde8b
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [customer_ip] => 36.110.8.226
+    [language] => en
+    [eci] => ECOMMERCE
+    [command] => PURCHASE
+    [response_message] => service inactive
+    [merchant_reference] => 229949005
+    [customer_email] => test@payfort.com
+    [currency] => USD
+    [status] => 00
+)
+
+
+========================================================
+
+Invalid Signature. Calculated Signature: eada8ff206dce16458d4d359f6966c9c3d82d99faed71193937a52010f1bde8b, Response Signature: e4cf0351a8f839ce4671a04eaa678540dc575ee6df7c614e9df49309bef7f0f2
+
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => USD
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 327482826
+    [customer_email] => test@payfort.com
+    [command] => PURCHASE
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [installments] => STANDALONE
+    [signature] => a08a4b9b434263f88adfcff1a845857757b416551a0e22b1de66c0702f73df99
+)
+
+
+========================================================
+
+Fort Redirect Response Parameters 
+Array
+(
+    [r] => processResponse
+    [amount] => 10000
+    [response_code] => 00093
+    [signature] => 8400e484e2aa1fad1aa21441a3a763a99639cfc610293e5c848a59bfb6e45ef2
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [customer_ip] => 36.110.8.226
+    [language] => en
+    [eci] => ECOMMERCE
+    [command] => PURCHASE
+    [response_message] => service inactive
+    [merchant_reference] => 327482826
+    [customer_email] => test@payfort.com
+    [currency] => USD
+    [status] => 00
+)
+
+
+========================================================
+
+Invalid Signature. Calculated Signature: 8400e484e2aa1fad1aa21441a3a763a99639cfc610293e5c848a59bfb6e45ef2, Response Signature: 1e5eb1a3dda4ec8594e888f8c800dda8739fc3c4f7b114611e2c76376c280803
+
+========================================================
+
+Fort Redirect Request Parameters 
+Array
+(
+    [amount] => 10000
+    [currency] => USD
+    [merchant_identifier] => qRVCYhzy
+    [access_code] => IvPf2BwOqHwvZ6PrE8xU
+    [merchant_reference] => 223730342
+    [customer_email] => test@payfort.com
+    [command] => PURCHASE
+    [language] => en
+    [return_url] => http://192.168.33.10/sg/payment/sdk/payfort/route.php?r=processResponse
+    [installments] => STANDALONE
+    [signature] => cf8a12107e056ef3c1804bf07edb22c41bc631caefe8470431fa377e11d117d9
+)
+
+