| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- use Webkul\Paypal\Helpers\PaypalPaymentDetails;
- use Webkul\Sales\Models\Order;
- use Webkul\Sales\Models\OrderPayment;
- use function Pest\Laravel\get;
- it('maps magento paypal additional labels for the admin order view', function () {
- $rows = PaypalPaymentDetails::rows([
- 'paypal' => [
- 'Payer ID' => 'S856CN296A3NY',
- 'Payer Email' => 'ms.karlotta@gmail.com',
- 'Payer Status' => 'unverified',
- 'Payer Address Status' => 'confirmed',
- 'Merchant Protection Eligibility' => 'Eligible',
- 'Last Correlation ID' => '4daa479620025',
- 'Last Transaction ID' => '9L903472H6583463Y',
- ],
- ]);
- expect($rows)->toHaveCount(7)
- ->and($rows[0])->toMatchArray([
- 'label' => trans('paypal::app.order.payer-id'),
- 'value' => 'S856CN296A3NY',
- ])
- ->and($rows[1]['value'])->toBe('ms.karlotta@gmail.com')
- ->and($rows[6]['value'])->toBe('9L903472H6583463Y');
- });
- it('falls back to paypal_* keys when the labeled paypal map is missing', function () {
- $rows = PaypalPaymentDetails::rows([
- 'paypal_payer_id' => 'S856CN296A3NY',
- 'paypal_payer_email' => 'ms.karlotta@gmail.com',
- 'last_trans_id' => '9L903472H6583463Y',
- 'asteria_payment_id' => 99,
- ]);
- expect(collect($rows)->pluck('value')->all())->toBe([
- 'S856CN296A3NY',
- 'ms.karlotta@gmail.com',
- '9L903472H6583463Y',
- ]);
- });
- it('should display paypal additional payment details on the admin order view', function () {
- $order = Order::factory()->create();
- OrderPayment::factory()->create([
- 'order_id' => $order->id,
- 'method' => 'paypal_standard',
- 'additional' => [
- 'magento_method' => 'paypal_express',
- 'last_trans_id' => '9L903472H6583463Y',
- 'paypal' => [
- 'Payer ID' => 'S856CN296A3NY',
- 'Payer Email' => 'ms.karlotta@gmail.com',
- 'Payer Status' => 'unverified',
- 'Payer Address Status' => 'confirmed',
- 'Merchant Protection Eligibility' => 'Eligible',
- 'Last Correlation ID' => '4daa479620025',
- 'Last Transaction ID' => '9L903472H6583463Y',
- ],
- ],
- ]);
- $this->loginAsAdmin();
- get(route('admin.sales.orders.view', $order->id))
- ->assertOk()
- ->assertSeeText(trans('paypal::app.order.payer-id'))
- ->assertSeeText('S856CN296A3NY')
- ->assertSeeText('ms.karlotta@gmail.com')
- ->assertSeeText('unverified')
- ->assertSeeText('Eligible')
- ->assertSeeText('4daa479620025')
- ->assertSeeText('9L903472H6583463Y');
- });
|