Skip to content

Commit 06732c3

Browse files
author
Idolov, Stanislav(sidolov)
committed
Merge pull request #715 from magento-folks/payment-interface-refactoring
[Folks]Payment interface refactoring
2 parents f8a4c72 + 22fec03 commit 06732c3

File tree

11 files changed

+32
-264
lines changed

11 files changed

+32
-264
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/braintree-paypal.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ define(
4747
return {
4848
'method': this.item.method,
4949
'po_number': null,
50-
'cc_owner': null,
51-
'cc_number': null,
52-
'cc_type': null,
53-
'cc_exp_year': null,
54-
'cc_exp_month': null,
5550
'additional_data': {
5651
'payment_method_nonce': this.paymentMethodNonce()
5752
}

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ define(
173173
getData: function () {
174174
return {
175175
'method': this.item.method,
176-
'cc_type': this.creditCardType(),
177-
'cc_exp_year': this.creditCardExpYear(),
178-
'cc_exp_month': this.creditCardExpMonth(),
179176
'additional_data': {
180177
'cc_last4': this.creditCardNumber().slice(-4),
181178
'store_in_vault': this.storeInVault(),
182179
'payment_method_nonce': this.paymentMethodNonce(),
183180
'cc_token': this.selectedCardToken(),
184-
'device_data': this.deviceData
181+
'device_data': this.deviceData,
182+
'cc_type': this.creditCardType(),
183+
'cc_exp_year': this.creditCardExpYear(),
184+
'cc_exp_month': this.creditCardExpMonth()
185185
}
186186
};
187187
},

app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ define(
157157
return {
158158
"method": this.item.method,
159159
"po_number": null,
160-
"cc_owner": null,
161-
"cc_number": null,
162-
"cc_type": null,
163-
"cc_exp_year": null,
164-
"cc_exp_month": null,
165160
"additional_data": null
166161
};
167162
},

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/purchaseorder-method.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ define(
2626
return {
2727
"method": this.item.method,
2828
'po_number': this.purchaseOrderNumber(),
29-
"cc_owner": null,
30-
"cc_number": null,
31-
"cc_type": null,
32-
"cc_exp_year": null,
33-
"cc_exp_month": null,
3429
"additional_data": null
3530
};
3631

app/code/Magento/Payment/view/frontend/web/js/view/payment/cc-form.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ define(
9090
getData: function() {
9191
return {
9292
'method': this.item.method,
93-
'cc_type': this.creditCardType(),
94-
'cc_exp_year': this.creditCardExpYear(),
95-
'cc_exp_month': this.creditCardExpMonth(),
96-
'cc_number': this.creditCardNumber(),
97-
additional_data: {
93+
'additional_data': {
9894
'cc_cid': this.creditCardVerificationNumber(),
9995
'cc_ss_start_month': this.creditCardSsStartMonth(),
100-
'cc_ss_start_year': this.creditCardSsStartYear()
96+
'cc_ss_start_year': this.creditCardSsStartYear(),
97+
'cc_type': this.creditCardType(),
98+
'cc_exp_year': this.creditCardExpYear(),
99+
'cc_exp_month': this.creditCardExpMonth(),
100+
'cc_number': this.creditCardNumber()
101101
}
102102
};
103103
},

app/code/Magento/Quote/Api/Data/PaymentInterface.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ interface PaymentInterface extends \Magento\Framework\Api\ExtensibleDataInterfac
1818

1919
const KEY_METHOD = 'method';
2020

21-
const KEY_CC_OWNER = 'cc_owner';
22-
23-
const KEY_CC_NUMBER = 'cc_number';
24-
25-
const KEY_CC_TYPE = 'cc_type';
26-
27-
const KEY_CC_EXP_YEAR = 'cc_exp_year';
28-
29-
const KEY_CC_EXP_MONTH = 'cc_exp_month';
30-
3121
const KEY_ADDITIONAL_DATA = 'additional_data';
3222

3323
/**#@-*/
@@ -62,81 +52,6 @@ public function getMethod();
6252
*/
6353
public function setMethod($method);
6454

65-
/**
66-
* Get credit card owner
67-
*
68-
* @return string|null
69-
*/
70-
public function getCcOwner();
71-
72-
/**
73-
* Set credit card owner
74-
*
75-
* @param string $ccOwner
76-
* @return $this
77-
*/
78-
public function setCcOwner($ccOwner);
79-
80-
/**
81-
* Get credit card number
82-
*
83-
* @return string|null
84-
*/
85-
public function getCcNumber();
86-
87-
/**
88-
* Set credit card number
89-
*
90-
* @param string $ccNumber
91-
* @return $this
92-
*/
93-
public function setCcNumber($ccNumber);
94-
95-
/**
96-
* Get credit card type
97-
*
98-
* @return string|null
99-
*/
100-
public function getCcType();
101-
102-
/**
103-
* Set credit card type
104-
*
105-
* @param string $ccType
106-
* @return $this
107-
*/
108-
public function setCcType($ccType);
109-
110-
/**
111-
* Get credit card expiration year
112-
*
113-
* @return string|null
114-
*/
115-
public function getCcExpYear();
116-
117-
/**
118-
* Set credit card expiration year
119-
*
120-
* @param string $ccExpYear
121-
* @return $this
122-
*/
123-
public function setCcExpYear($ccExpYear);
124-
125-
/**
126-
* Get credit card expiration month
127-
*
128-
* @return string|null
129-
*/
130-
public function getCcExpMonth();
131-
132-
/**
133-
* Set credit card expiration month
134-
*
135-
* @param string $ccExpMonth
136-
* @return $this
137-
*/
138-
public function setCcExpMonth($ccExpMonth);
139-
14055
/**
14156
* Get payment additional details
14257
*

app/code/Magento/Quote/Model/Quote/Payment.php

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -273,112 +273,6 @@ public function setMethod($method)
273273
return $this->setData(self::KEY_METHOD, $method);
274274
}
275275

276-
/**
277-
* Get credit card owner
278-
*
279-
* @return string|null
280-
*/
281-
public function getCcOwner()
282-
{
283-
return $this->getData(self::KEY_CC_OWNER);
284-
}
285-
286-
/**
287-
* Set credit card owner
288-
*
289-
* @param string $ccOwner
290-
* @return $this
291-
*/
292-
public function setCcOwner($ccOwner)
293-
{
294-
return $this->setData(self::KEY_CC_OWNER, $ccOwner);
295-
}
296-
297-
/**
298-
* Get credit card number
299-
*
300-
* @return string|null
301-
*/
302-
public function getCcNumber()
303-
{
304-
return $this->getData(self::KEY_CC_NUMBER);
305-
}
306-
307-
/**
308-
* Set credit card number
309-
*
310-
* @param string $ccNumber
311-
* @return $this
312-
*/
313-
public function setCcNumber($ccNumber)
314-
{
315-
return $this->setData(self::KEY_CC_NUMBER, $ccNumber);
316-
}
317-
318-
/**
319-
* Get credit card type
320-
*
321-
* @return string|null
322-
*/
323-
public function getCcType()
324-
{
325-
return $this->getData(self::KEY_CC_TYPE);
326-
}
327-
328-
/**
329-
* Set credit card type
330-
*
331-
* @param string $ccType
332-
* @return $this
333-
*/
334-
public function setCcType($ccType)
335-
{
336-
return $this->setData(self::KEY_CC_TYPE, $ccType);
337-
}
338-
339-
/**
340-
* Get credit card expiration year
341-
*
342-
* @return string|null
343-
*/
344-
public function getCcExpYear()
345-
{
346-
$expirationYear = $this->getData(self::KEY_CC_EXP_YEAR) ?: null;
347-
return $expirationYear;
348-
}
349-
350-
/**
351-
* Set credit card expiration year
352-
*
353-
* @param string $ccExpYear
354-
* @return $this
355-
*/
356-
public function setCcExpYear($ccExpYear)
357-
{
358-
return $this->setData(self::KEY_CC_EXP_YEAR, $ccExpYear);
359-
}
360-
361-
/**
362-
* Get credit card expiration month
363-
*
364-
* @return string|null
365-
*/
366-
public function getCcExpMonth()
367-
{
368-
return $this->getData(self::KEY_CC_EXP_MONTH);
369-
}
370-
371-
/**
372-
* Set credit card expiration month
373-
*
374-
* @param string $ccExpMonth
375-
* @return $this
376-
*/
377-
public function setCcExpMonth($ccExpMonth)
378-
{
379-
return $this->setData(self::KEY_CC_EXP_MONTH, $ccExpMonth);
380-
}
381-
382276
/**
383277
* Get payment additional details
384278
*

app/code/Magento/Quote/Test/Unit/Model/Quote/PaymentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function yearValueDataProvider()
4343
return [
4444
[null, null],
4545
[0, null],
46-
['0', null],
46+
['0', 0],
4747
[1939, 1939],
4848
];
4949
}

dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ public function testReSetPayment()
8181
"cartId" => $cartId,
8282
"method" => [
8383
'method' => 'checkmo',
84-
'po_number' => null,
85-
'cc_owner' => 'John',
86-
'cc_type' => null,
87-
'cc_exp_year' => null,
88-
'cc_exp_month' => null,
84+
'po_number' => null
8985
],
9086
];
9187

@@ -118,11 +114,7 @@ public function testSetPaymentWithVirtualProduct()
118114
"cartId" => $cartId,
119115
"method" => [
120116
'method' => 'checkmo',
121-
'po_number' => '200',
122-
'cc_owner' => 'tester',
123-
'cc_type' => 'test',
124-
'cc_exp_year' => '2014',
125-
'cc_exp_month' => '1',
117+
'po_number' => '200'
126118
],
127119
];
128120
$this->assertNotNull($this->_webApiCall($serviceInfo, $requestData));
@@ -154,11 +146,7 @@ public function testSetPaymentWithSimpleProduct()
154146
"cartId" => $cartId,
155147
"method" => [
156148
'method' => 'checkmo',
157-
'po_number' => '200',
158-
'cc_owner' => 'tester',
159-
'cc_type' => 'test',
160-
'cc_exp_year' => '2014',
161-
'cc_exp_month' => '1',
149+
'po_number' => '200'
162150
],
163151
];
164152

@@ -193,11 +181,7 @@ public function testSetPaymentWithSimpleProductWithoutAddress()
193181
"cartId" => $cartId,
194182
"method" => [
195183
'method' => 'checkmo',
196-
'po_number' => '200',
197-
'cc_owner' => 'tester',
198-
'cc_type' => 'test',
199-
'cc_exp_year' => '2014',
200-
'cc_exp_month' => '1',
184+
'po_number' => '200'
201185
],
202186
];
203187
$this->assertNotNull($this->_webApiCall($serviceInfo, $requestData));
@@ -275,7 +259,7 @@ public function testGet()
275259
*/
276260
protected function getPaymentMethodFieldsForAssert()
277261
{
278-
return ['method', 'po_number', 'cc_owner', 'cc_type', 'cc_exp_year', 'cc_exp_month', 'additional_data'];
262+
return ['method', 'po_number', 'additional_data'];
279263
}
280264

281265
/**

0 commit comments

Comments
 (0)