New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save payment method name correctly as selected by payer #41

Merged
merged 9 commits into from Nov 8, 2017

Conversation

Projects
None yet
1 participant
@nimid
Contributor

nimid commented Nov 8, 2017

1. Objective

Save payment method name correctly as selected by payer.

Currently, Omise PrestaShop has more than one payment method, card payment and internet banking payment. The payment method name that saved to the order should reflected the actual payment method that was chosen by the payer.

Related information:

  • Related issue: -
  • Related ticket: -

2. Description of change

  • Modify a function for save the order, PaymentOrder.save(). Make it requires one more parameter, payment method name.

  • Modify all functions that saving the order. Make it send the required parameters.

  • Unused and remove a function, PaymentOrder.saveAsProcessing(). To make the module has one function for save the order which is PaymentOrder.save().

  • Change the field used to check the condition of the module of saved order, when return from Omise API.

3. Quality assurance

Environments:

  • Platform: PrestaShop 1.7.2.4
  • Omise plugin: Omise PrestaShop 1.3
  • PHP: 5.6.31

Details:

Before change

The payment method name that saved to the order has been fixed by using name, Omise (Omise::MODULE_DISPLAY_NAME).

The screenshot below shows PrestaShop back office, order detail page. In the red box, the payment method of this order is fixed, Omise.

prestashop-1 7 2 4-fixed-payment-method-name

After change

The payment method that saved to the order is the actual payment method that selected by payer.

The screenshot below shows PrestaShop front office, completed card payment page. In the red box, the payment method name of card payment is the setting of title.

prestashop-1 7 2 4-successful-omise-card-payment

The screenshot below shows PrestaShop back office, order detail page. In the red box, the payment method name of card payment is the setting of title.

prestashop-1 7 2 4-back-office-order-detail-page-payment-method-is-setting-of-title

The screenshot below shows PrestaShop front office, completed internet banking payment page. In the red box, the payment method name is Internet Banking.

prestashop-1 7 2 4-successful-omise-internet-banking-payment

The screenshot below shows PrestaShop back office, order detail page. In the red box, the payment method name of internet banking payment is Internet Banking.

prestashop-1 7 2 4-back-office-order-detail-page-internet-banking-payment-method

4. Impact of the change

-

5. Priority of change

Normal

6. Additional notes

For the payment method name saved to the order, card payment is the setting of title. Internet banking payment is fixed the name Internet Banking.

nimid added some commits Nov 7, 2017

Refactor, change a param name of PaymentOrder.save
Modify a name of parameter of a function, PaymentOrder.save().
Change a name of parameter from $order_state to $id_order_state.

Make the name consistent with PrestaShop. An example from PrestaShop
function is PaymentModule.validateOrder().

A parameter that PaymentOrder.save() required is ID of order status.
Using $order_state (before change) can be confused that it is the
instance of OrderState class.
Refactor, PaymentOrder.save() required order state
Modify a parameter of a function, PaymentOrder.save(). The
$id_order_state is required.
Saving an order can be specified payment method
Change parameters of function, PaymentOrder.save()

Add a parameter, $payment_method, to the second input parameter.
Remove a function, PaymentOrder.saveAsProcessing()
Makes the module has only one function, gate or place to save an order.

A function that used to save an order is PaymentOrder.save().
Change IB payment, save order with payment method
Change internet banking payment. Make it save an order with its payment
method name.
Change card payment save order with payment method
Change card payment. Make it save an order with its payment method name.
Change 3DS payment, save order with payment method
Change 3-D Secure payment. Make it save an order with its payment method
name.
Check module of saved order when return from Omise
Check the module name of saved order when return from Omise API.

According to the payment method of saved order has been dynamically
saved follows the payment method that customer selected. Such as card
payment or internet banking payment.

Therefor, payment method of saved order (order->payment) is variable.
It can not be used to check whether the order is the order that made
payment with Omise.

So, using module name of saved order (order->module) to check with
Omise.MODULE_NAME is properly.
Modify unit tests follow the actual source code
Reduced the duplicated mocking source code by move it to the
autoload.php.

@nimid nimid merged commit f215d2d into support-prestashop-1.7 Nov 8, 2017

@nimid nimid deleted the correctly-display-payment-method branch Nov 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment