MediaWiki fundraising/REL1_35
PayPalAmount.php
Go to the documentation of this file.
1<?php
2
3class PayPalAmount extends Amount implements StagingHelper {
4
5 public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
6 $stagedData[ 'amount' ] = static::round( $normalized[ 'amount' ], $normalized[ 'currency' ] );
7 }
8
9 public static function is_fractional_currency( $currency_code ) {
10 // cause this function only used for paypal, no need to check more than paypal supported currencies
11 // https://developer.paypal.com/braintree/docs/reference/general/currencies
12 $non_fractional_currencies = [ 'JPY', 'HUF', 'TWD' ];
13
14 if ( in_array( strtoupper( $currency_code ), $non_fractional_currencies ) ) {
15 return false;
16 }
17 return true;
18 }
19}
stage(GatewayType $adapter, $normalized, &$stagedData)
Transform a subset of normalized data into the "staged" data expected by a payment processor.
static is_fractional_currency( $currency_code)
If an amount is ever expressed for the fractional currencies defined in this function,...
GatewayType Interface.
Used to mark any class which implements an staging method, for transforming data into the form expect...