Skip to content

Commit

Permalink
Improve amount format.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jul 2, 2021
1 parent a57ee2a commit 59650a0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/DataGeneralHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public function set_order_description( $description ) {
/**
* Set amount
*
* @param float $amount Amount in cents.
*
* @param string $amount Amount in cents.
* @return DataGeneralHelper
*/
public function set_amount( $amount ) {
Expand Down
2 changes: 1 addition & 1 deletion src/DirectLink/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function start( Payment $payment ) {
->set_order_description( $payment->get_description() )
->set_param_plus( 'payment_id=' . $payment->get_id() )
->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() )
->set_amount( $payment->get_total_amount()->get_cents() );
->set_amount( $payment->get_total_amount()->get_minor_units()->format( 0, '', '' ) );

// Alias.
if ( $this->config->alias_enabled ) {
Expand Down
2 changes: 1 addition & 1 deletion src/OrderStandard/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function get_output_fields( Payment $payment ) {
->set_order_description( $payment->get_description() )
->set_param_plus( 'payment_id=' . $payment->get_id() )
->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() )
->set_amount( $payment->get_total_amount()->get_minor_units() );
->set_amount( $payment->get_total_amount()->get_minor_units()->format( 0, '', '' ) );

// Alias.
$alias = $payment->get_meta( 'ogone_alias' );
Expand Down
4 changes: 2 additions & 2 deletions tests/src/DataGeneralHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function test_helper() {
->set_psp_id( 'test' )
->set_order_id( '1234' )
->set_order_description( 'order description' )
->set_amount( 1050 )
->set_amount( '1050' )
->set_currency( 'EUR' )
->set_customer_name( 'Mr. Test' )
->set_email( '[email protected]' )
Expand All @@ -47,7 +47,7 @@ public function test_helper() {
'PSPID' => 'test',
'ORDERID' => '1234',
'COM' => 'order description',
'AMOUNT' => 1050,
'AMOUNT' => '1050',
'CURRENCY' => 'EUR',
'CN' => 'Mr. Test',
'EMAIL' => '[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/OrderStandard/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function test_signature_in_from_documentation() {
$ogone_data_general = new DataGeneralHelper( $ogone_data );

$ogone_data_general
->set_amount( 1500 )
->set_amount( '1500' )
->set_currency( 'EUR' )
->set_language( 'en_US' )
->set_order_id( '1234' );
Expand Down

0 comments on commit 59650a0

Please sign in to comment.