|
@@ -199,6 +199,9 @@ function __construct(){
|
|
|
$pay = $v['gateway'];
|
|
|
}
|
|
|
}else{
|
|
|
+ if(count($v['payment_gateway_names'])>1){
|
|
|
+ $v['payment_gateway_names'] = array_reverse($v['payment_gateway_names']);
|
|
|
+ }
|
|
|
if(isset($v['payment_gateway_names'])&&isset($v['payment_gateway_names'][0])){
|
|
|
if(stripos($v['payment_gateway_names'][0],'shopify_') !== false)
|
|
|
{
|
|
@@ -616,34 +619,63 @@ function __construct(){
|
|
|
// $headerA = curl_getinfo($ch)
|
|
|
|
|
|
$a = json_decode($res,true);
|
|
|
+
|
|
|
if(!isset($a['transactions']))
|
|
|
{
|
|
|
return array('g'=>0);exit;
|
|
|
}
|
|
|
- if($a['transactions'][0]['gateway'] == 'Klarna' ){
|
|
|
- return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
- }elseif(stripos($a['transactions'][0]['gateway'],'Afterpay') !== false){
|
|
|
- return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
- }elseif(stripos($a['transactions'][0]['gateway'],'Airwallex') !== false){
|
|
|
- return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
- }else{
|
|
|
- $a['transactions'] = array_reverse($a['transactions']);
|
|
|
- if(isset($a['transactions'][0]['authorization']))
|
|
|
- {
|
|
|
- $protection_eligibility = "";
|
|
|
- if(isset($a['transactions'][0]['receipt'])){
|
|
|
- if(isset($a['transactions'][0]['receipt']['protection_eligibility'])){
|
|
|
- $protection_eligibility = $a['transactions'][0]['receipt']['protection_eligibility'];
|
|
|
+ if(count($a['transactions']) < 2){
|
|
|
+ if($a['transactions'][0]['gateway'] == 'Klarna' ){
|
|
|
+ return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }elseif(stripos($a['transactions'][0]['gateway'],'Afterpay') !== false){
|
|
|
+ return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }elseif(stripos($a['transactions'][0]['gateway'],'Airwallex') !== false){
|
|
|
+ return array('g'=>1,'d'=>$a['transactions'][0]['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }else{
|
|
|
+ $a['transactions'] = array_reverse($a['transactions']);
|
|
|
+ if(isset($a['transactions'][0]['authorization']))
|
|
|
+ {
|
|
|
+ $protection_eligibility = "";
|
|
|
+ if(isset($a['transactions'][0]['receipt'])){
|
|
|
+ if(isset($a['transactions'][0]['receipt']['protection_eligibility'])){
|
|
|
+ $protection_eligibility = $a['transactions'][0]['receipt']['protection_eligibility'];
|
|
|
+ }
|
|
|
}
|
|
|
+ return array('g'=>1,'d'=>$a['transactions'][0]['authorization'],'protection_eligibility'=>$protection_eligibility);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return array('g'=>0);
|
|
|
}
|
|
|
- return array('g'=>1,'d'=>$a['transactions'][0]['authorization'],'protection_eligibility'=>$protection_eligibility);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- return array('g'=>0);
|
|
|
+ }else{
|
|
|
+ $end_info = end($a['transactions']);
|
|
|
+ if($end_info['gateway'] == 'Klarna' ){
|
|
|
+ return array('g'=>1,'d'=>$end_info['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }elseif(stripos($end_info['gateway'],'Afterpay') !== false){
|
|
|
+ return array('g'=>1,'d'=>$end_info['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }elseif(stripos($end_info['gateway'],'Airwallex') !== false){
|
|
|
+ return array('g'=>1,'d'=>$end_info['payment_id'],'protection_eligibility'=>"");
|
|
|
+ }else{
|
|
|
+ $a['transactions'] = array_reverse($a['transactions']);
|
|
|
+ if(isset($a['transactions'][0]['authorization']))
|
|
|
+ {
|
|
|
+ $protection_eligibility = "";
|
|
|
+ if(isset($a['transactions'][0]['receipt'])){
|
|
|
+ if(isset($a['transactions'][0]['receipt']['protection_eligibility'])){
|
|
|
+ $protection_eligibility = $a['transactions'][0]['receipt']['protection_eligibility'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return array('g'=>1,'d'=>$a['transactions'][0]['authorization'],'protection_eligibility'=>$protection_eligibility);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return array('g'=>0);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function su_curl($data,$url,$header=array(),$date_type='json',$timeout=300,$httptype="POST",$userpwd='')
|