This repository was archived by the owner on Oct 15, 2024. It is now read-only.
Commit 3dee9fa 1 parent 2fdc090 commit 3dee9fa Copy full SHA for 3dee9fa
File tree 2 files changed +11
-11
lines changed
2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ protected function initialize()
118
118
$ this ->data ->receivers = [];
119
119
$ this ->data ->checkoutPreferences = new stdClass ();
120
120
$ this ->data ->checkoutPreferences ->redirectUrls = new stdClass ();
121
+ $ this ->data ->checkoutPreferences ->installments = [];
121
122
}
122
123
123
124
/**
@@ -609,12 +610,14 @@ public function setUrlFailure($urlFailure = '')
609
610
*
610
611
* @return $this
611
612
*/
612
- public function setInstallmentCheckoutPreferences ($ quantity , $ discountValue = 0 , $ additionalValue = 0 )
613
+ public function addInstallmentCheckoutPreferences ($ quantity , $ discountValue = 0 , $ additionalValue = 0 )
613
614
{
614
- $ this ->data ->checkoutPreferences ->installments = new stdClass ();
615
- $ this ->data ->checkoutPreferences ->installments ->quantity = $ quantity ;
616
- $ this ->data ->checkoutPreferences ->installments ->discount = $ discountValue ;
617
- $ this ->data ->checkoutPreferences ->installments ->addition = $ additionalValue ;
615
+ $ installmentCheckoutPreferences = new stdClass ();
616
+ $ installmentCheckoutPreferences ->quantity = $ quantity ;
617
+ $ installmentCheckoutPreferences ->discount = $ discountValue ;
618
+ $ installmentCheckoutPreferences ->addition = $ additionalValue ;
619
+
620
+ $ this ->data ->checkoutPreferences ->installments [] = $ installmentCheckoutPreferences ;
618
621
619
622
return $ this ;
620
623
}
Original file line number Diff line number Diff line change @@ -120,19 +120,16 @@ public function testCreateOrderWithInstallmentPreferences()
120
120
$ quantity = [1 , 6 ];
121
121
$ discount = 0 ;
122
122
$ additional = 100 ;
123
- $ order = $ this ->createOrder ()->setInstallmentCheckoutPreferences ($ quantity , $ discount , $ additional );
123
+ $ order = $ this ->createOrder ()->addInstallmentCheckoutPreferences ($ quantity , $ discount , $ additional );
124
124
$ returned_order = $ this ->executeOrder ($ order );
125
-
126
125
$ this ->assertNotEmpty ($ returned_order ->getId ());
127
- $ this ->assertEquals ([1 , 6 ], $ returned_order ->getCheckoutPreferences ()->installments ->quantity );
126
+ $ this ->assertEquals ([1 , 6 ], $ returned_order ->getCheckoutPreferences ()->installments [ 0 ] ->quantity );
128
127
}
129
128
130
129
public function testCreateOrderAddingReceiverNoAmount ()
131
130
{
132
131
$ order = $ this ->createOrder ()->addReceiver ('MPA-7ED9D2D0BC81 ' , 'PRIMARY ' );
133
- $ returned_order = $ this ->executeOrder ($ order );
134
- $ this ->assertNotEmpty ($ returned_order ->getId ());
135
- $ receivers = $ returned_order ->getReceiverIterator ();
132
+ $ receivers = $ order ->getReceiverIterator ();
136
133
$ this ->assertEquals ('MPA-7ED9D2D0BC81 ' , $ receivers [0 ]->moipAccount ->id );
137
134
}
138
135
You can’t perform that action at this time.
0 commit comments