@@ -63,41 +63,7 @@ public function execute()
63
63
return $ this ->_redirect ('multishipping/checkout/success ' );
64
64
}
65
65
66
- if ($ method === 'cc ' ) {
67
- $ requestData = array (
68
- 'token_id ' => $ tokenId ,
69
- 'card_cvn ' => $ cvn ,
70
- 'amount ' => $ transactionAmount ,
71
- 'external_id ' => $ this ->getDataHelper ()->getExternalId ($ rawOrderIds ),
72
- 'return_url ' => $ this ->getDataHelper ()->getThreeDSResultUrl ($ rawOrderIds , true )
73
- );
74
-
75
- $ charge = $ this ->requestCharge ($ requestData );
76
-
77
- $ chargeError = isset ($ charge ['error_code ' ]) ? $ charge ['error_code ' ] : null ;
78
- if ($ chargeError == 'EXTERNAL_ID_ALREADY_USED_ERROR ' ) {
79
- $ newRequestData = array_replace ($ requestData , array (
80
- 'external_id ' => $ this ->getDataHelper ()->getExternalId ($ rawOrderIds , true )
81
- ));
82
- $ charge = $ this ->requestCharge ($ newRequestData );
83
- }
84
-
85
- $ chargeError = isset ($ charge ['error_code ' ]) ? $ charge ['error_code ' ] : null ;
86
- if ($ chargeError == 'AUTHENTICATION_ID_MISSING_ERROR ' ) {
87
- return $ this ->handle3DSFlow ($ requestData , $ payment , $ orderIds , $ orders );
88
- }
89
-
90
- if ($ chargeError !== null ) {
91
- return $ this ->processFailedPayment ($ orderIds , $ chargeError );
92
- }
93
-
94
- if ($ charge ['status ' ] === 'CAPTURED ' ) {
95
- return $ this ->processSuccessfulPayment ($ orders , $ payment , $ charge );
96
- } else {
97
- return $ this ->processFailedPayment ($ orderIds , $ charge ['failure_reason ' ]);
98
- }
99
- }
100
- else if ($ method === 'cchosted ' || $ method === 'cc_installment ' || $ method === 'cc_subscription ' ) {
66
+ if ($ method === 'cc_subscription ' ) {
101
67
$ requestData = array (
102
68
'order_number ' => $ rawOrderIds ,
103
69
'amount ' => $ transactionAmount ,
@@ -112,27 +78,7 @@ public function execute()
112
78
$ billingAddress = $ orders [0 ]->getBillingAddress ();
113
79
$ shippingAddress = $ orders [0 ]->getShippingAddress ();
114
80
115
- if ($ method === 'cc_installment ' ) {
116
- $ firstName = $ billingAddress ->getFirstname () ?: $ shippingAddress ->getFirstname ();
117
- $ country = $ billingAddress ->getCountryId () ?: $ shippingAddress ->getCountryId ();
118
- $ billingDetails = array (
119
- 'given_names ' => ($ firstName ?: 'N/A ' ),
120
- 'surname ' => ($ billingAddress ->getLastname () ?: null ),
121
- 'email ' => ($ billingAddress ->getEmail () ?: null ),
122
- 'phone_number ' => ($ billingAddress ->getTelephone () ?: null ),
123
- 'address ' => array (
124
- 'country ' => ($ country ?: 'ID ' ),
125
- 'street_line_1 ' => ($ billingAddress ->getStreetLine (1 ) ?: null ),
126
- 'street_line_2 ' => ($ billingAddress ->getStreetLine (2 ) ?: null ),
127
- 'city ' => ($ billingAddress ->getCity () ?: null ),
128
- 'state ' => ($ billingAddress ->getRegion () ?: null ),
129
- 'postal_code ' => ($ billingAddress ->getPostcode () ?: null )
130
- )
131
- );
132
-
133
- $ requestData ['is_installment ' ] = "true " ;
134
- $ requestData ['billing_details ' ] = json_encode ($ billingDetails , JSON_FORCE_OBJECT );
135
- } else if ($ method === 'cc_subscription ' ) {
81
+ if ($ method === 'cc_subscription ' ) {
136
82
$ requestData ['payment_type ' ] = 'CREDIT_CARD_SUBSCRIPTION ' ;
137
83
$ requestData ['is_subscription ' ] = "true " ;
138
84
$ requestData ['subscription_callback_url ' ] = $ this ->getDataHelper ()->getXenditSubscriptionCallbackUrl (true );
0 commit comments