@@ 40-49 (lines=10) @@ | ||
37 | $this->assertNotEmpty($payment->getFundingInstrument()->boleto); |
|
38 | } |
|
39 | ||
40 | public function testCreditCardPCIStore() |
|
41 | { |
|
42 | $this->mockHttpSession($this->body_order); |
|
43 | $order = $this->createOrder()->create(); |
|
44 | $cc = '5555666677778884'; |
|
45 | $this->mockHttpSession($this->body_cc_pay_pci_store); |
|
46 | $payment = $order->payments()->setCreditCard(5, 2018, $cc, 123, $this->createCustomer(), false)->execute(); |
|
47 | $this->assertFalse($payment->getFundingInstrument()->creditCard->store); |
|
48 | $this->assertNotEmpty($payment->getId()); |
|
49 | } |
|
50 | ||
51 | public function testShouldCreateEscrowPaymentWithCreditCard() |
|
52 | { |
|
@@ 51-62 (lines=12) @@ | ||
48 | $this->assertNotEmpty($payment->getId()); |
|
49 | } |
|
50 | ||
51 | public function testShouldCreateEscrowPaymentWithCreditCard() |
|
52 | { |
|
53 | $this->mockHttpSession($this->body_order); |
|
54 | $order = $this->createOrder()->create(); |
|
55 | $cc = '5555666677778884'; |
|
56 | $this->mockHttpSession($this->body_cc_pay_pci_escrow); |
|
57 | $payment = $order->payments() |
|
58 | ->setCreditCard(5, 2018, $cc, 123, $this->createCustomer(), false) |
|
59 | ->setEscrow('teste de descricao') |
|
60 | ->execute(); |
|
61 | $this->assertEquals('teste de descricao', $payment->getEscrow()->description); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * MoipTest creating a credit card multipayment, passing all credit card data. |
|
@@ 93-107 (lines=15) @@ | ||
90 | $this->assertNotEmpty($payment->getFundingInstrument()->boleto); |
|
91 | } |
|
92 | ||
93 | public function testCapturePreAuthorizedPayment() |
|
94 | { |
|
95 | $this->mockHttpSession($this->body_order); |
|
96 | $order = $this->createOrder()->create(); |
|
97 | $this->mockHttpSession($this->body_cc_delay_capture); |
|
98 | $payment = $order->payments() |
|
99 | ->setCreditCard(5, 2018, '5555666677778884', 123, $this->createCustomer(), false) |
|
100 | ->setDelayCapture(true) |
|
101 | ->execute(); |
|
102 | ||
103 | $this->mockHttpSession($this->body_capture_pay); |
|
104 | $captured_payment = $payment->capture(); |
|
105 | ||
106 | $this->assertEquals('AUTHORIZED', $captured_payment->getStatus()); |
|
107 | } |
|
108 | ||
109 | public function testCapturePreAuthorizedMultiPayment() |
|
110 | { |
|
@@ 109-123 (lines=15) @@ | ||
106 | $this->assertEquals('AUTHORIZED', $captured_payment->getStatus()); |
|
107 | } |
|
108 | ||
109 | public function testCapturePreAuthorizedMultiPayment() |
|
110 | { |
|
111 | $this->mockHttpSession($this->body_multiorder); |
|
112 | $order = $this->createMultiorder()->create(); |
|
113 | $this->mockHttpSession($this->body_cc_multipay); |
|
114 | $payment = $order->multipayments() |
|
115 | ->setCreditCard(5, 2018, '4012001037141112', 123, $this->createCustomer()) |
|
116 | ->setDelayCapture(true) |
|
117 | ->execute(); |
|
118 | ||
119 | $this->mockHttpSession($this->body_capture_multipay); |
|
120 | $captured_payment = $payment->capture(); |
|
121 | ||
122 | $this->assertEquals('AUTHORIZED', $captured_payment->getStatus()); |
|
123 | } |
|
124 | ||
125 | public function testCancelPreAuthorizedMultiPayment() |
|
126 | { |
|
@@ 125-139 (lines=15) @@ | ||
122 | $this->assertEquals('AUTHORIZED', $captured_payment->getStatus()); |
|
123 | } |
|
124 | ||
125 | public function testCancelPreAuthorizedMultiPayment() |
|
126 | { |
|
127 | $this->mockHttpSession($this->body_multiorder); |
|
128 | $order = $this->createMultiorder()->create(); |
|
129 | $this->mockHttpSession($this->body_cc_multipay); |
|
130 | $payment = $order->multipayments() |
|
131 | ->setCreditCard(5, 2018, '4012001037141112', 123, $this->createCustomer()) |
|
132 | ->setDelayCapture(true) |
|
133 | ->execute(); |
|
134 | ||
135 | $this->mockHttpSession($this->body_cancel_multipay); |
|
136 | $cancelled_payment = $payment->cancel(); |
|
137 | ||
138 | $this->assertEquals('CANCELLED', $cancelled_payment->getStatus()); |
|
139 | } |
|
140 | ||
141 | public function testCancelPreAuthorizedPayment() |
|
142 | { |
|
@@ 141-155 (lines=15) @@ | ||
138 | $this->assertEquals('CANCELLED', $cancelled_payment->getStatus()); |
|
139 | } |
|
140 | ||
141 | public function testCancelPreAuthorizedPayment() |
|
142 | { |
|
143 | $this->mockHttpSession($this->body_order); |
|
144 | $order = $this->createOrder()->create(); |
|
145 | $this->mockHttpSession($this->body_cc_delay_capture); |
|
146 | $payment = $order->payments() |
|
147 | ->setCreditCard(5, 2018, '5555666677778884', 123, $this->createCustomer(), false) |
|
148 | ->setDelayCapture(true) |
|
149 | ->execute(); |
|
150 | ||
151 | $this->mockHttpSession($this->body_cancel_pay); |
|
152 | $cancelled_payment = $payment->cancel(); |
|
153 | ||
154 | $this->assertEquals('CANCELLED', $cancelled_payment->getStatus()); |
|
155 | } |
|
156 | ||
157 | public function testGetPayment() |
|
158 | { |