Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/355552 )
Change subject: Split provider configuration out of main ...................................................................... Split provider configuration out of main Each gets its own dir because they'll eventually have all the settings from DonationInterface's config directories. This is just a transitional commit, on the way to fully splitting out a ProviderConfiguration class from GlobalConfiguration. Eventually we'll be able to load multiple provider configurations at the same time, so for example we can choose a provider based on capabilities. Change-Id: I6009e97e9875feea584c7baaa129bb3aea97ddd5 --- M Core/Configuration.php A config/adyen/main.yaml A config/amazon/main.yaml A config/dlocal/main.yaml A config/ingenico/main.yaml M config/main.yaml A config/paypal/main.yaml 7 files changed, 496 insertions(+), 480 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig refs/changes/52/355552/1 diff --git a/Core/Configuration.php b/Core/Configuration.php index 4ea30ca..d9e38ad 100644 --- a/Core/Configuration.php +++ b/Core/Configuration.php @@ -91,6 +91,18 @@ public function getDefaultSearchPath() { $searchPath = array(); + + // FIXME: The whole 'view' thing is going to go away when we split into + // GlobalConfiguration and ProviderConfiguration + if ( $this->view !== 'default' ) { + + if ( isset( $_SERVER['HOME'] ) ) { + $searchPath[] = "{$_SERVER['HOME']}/.smashpig/{$this->view}/main.yaml"; + } + $searchPath[] = "/etc/smashpig/{$this->view}/main.yaml"; + $searchPath[] = __DIR__ . "/../config/{$this->view}/main.yaml"; + } + if ( isset( $_SERVER['HOME'] ) ) { // FIXME: But I don't understand why this key is missing during testing. $searchPath[] = "{$_SERVER['HOME']}/.smashpig/main.yaml"; @@ -131,18 +143,8 @@ // the sources up front than keep them distinct and search through them // at runtime for the first matching key. foreach ( array_reverse( $configs ) as $config ) { - if ( isset( $config['default'] ) ) { - $this->override( $config['default'] ); - } - } - - // Now, go through in the same order and let all $view sections override - // defaults. - if ( $this->viewName !== 'default' ) { - foreach ( array_reverse( $configs ) as $config ) { - if ( isset( $config[$this->viewName] ) ) { - $this->override( $config[$this->viewName] ); - } + if ( !empty( $config ) ) { + $this->override( $config ); } } } diff --git a/config/adyen/main.yaml b/config/adyen/main.yaml new file mode 100644 index 0000000..4ca76a9 --- /dev/null +++ b/config/adyen/main.yaml @@ -0,0 +1,125 @@ +# Settings for Adyen +# +# To override, create a file in: +# /etc/smashpig/adyen/main.yaml +# $HOME/.smashpig/adyen/main.yaml + +logging: + root-context: SmashPig-Adyen + +endpoints: + listener: + class: SmashPig\PaymentProviders\Adyen\AdyenListener + +# FIXME: let's use this node to map payment methods to classes that +# implement doPayment (aka gateway adapters). See ingenico below. +payment-provider: + adyen: + api: + class: SmashPig\PaymentProviders\Adyen\AdyenPaymentsAPI + + payments-wsdl: https://pal-live.adyen.com/pal/Payment.wsdl + #payments-wsdl: https://pal-test.adyen.com/pal/Payment.wsdl + + accounts: {} + # FIXME: Provide sample account config more consistently. The + # empty map above is easy to overlook. + + # For each Adyen merchant account, add an entry like the + # following with the merchant account name as the key. + # The ws- credentials should be a user authorized to make + # API calls, and the report- credentials should be a user + # authorized to download reports. Reports will be + # downloaded to the location specified in report-location. + # + # At least one account and all subkeys are required. + # + # example-account-name: + # ws-username: "" + # ws-password: "" + # report-username: "" + # report-password: "" + # report-location: "/tmp" + +fraud-filters: + # Automatically capture authorizations under this score + review-threshold: 75 + # Automatically cancel authorizations with at least this score + reject-threshold: 125 + + # Authorization notifications include AVS and CVV result codes. + # The following maps set a risk score for each result code, which + # we combine with any risk score computed on the payment site to + # decide whether to capture the payment or leave it for review. + # https://docs.adyen.com/manuals/api-manual/payment-responses/additionaldata-payment-responses + avs-map: + # Unknown. This is often returned in non-AVS countries. + 0: 50 + # Address matches, postal code doesn't + 1: 75 + # Neither postal code nor address match + 2: 100 + # AVS unavailable + 3: 50 + # AVS not supported for this card type + 4: 50 + # No AVS data provided + 5: 50 + # Postal code matches, address doesn't match + 6: 75 + # Both postal code and address match + 7: 0 + # Address not checked, postal code unknown + 8: 50 + # Address matches, postal code unknown + 9: 25 + # Address doesn't match, postal code unknown + 10: 50 + # Postal code not checked, address unknown + 11: 75 + # Address matches, postal code not checked + 12: 50 + # Address doesn't match, postal code not checked + 13: 0 + # Postal code matches, address unknown + 14: 50 + # Postal code matches, address not checked + 15: 50 + # Postal code doesn't match, address unknown + 16: 75 + # Postal code doesn't match, address not checked + 17: 100 + # Neither postal code nor address were checked + 18: 25 + # Name and postal code matches + 19: 0 + # Name, address and postal code matches + 20: 0 + # Name and address matches + 21: 0 + # Name matches + 22: 50 + # Postal code matches, name doesn't match + 23: 50 + # Both postal code and address matches, name doesn't match + 24: 25 + # Address matches, name doesn't match + 25: 50 + # Neither postal code, address nor name matches + 26: 100 + + cvv-map: + # Unknown + 0: 100 + # Matches + 1: 0 + # Doesn't match + 2: 100 + # Not checked + 3: 50 + # No CVC/CVV provided, but was required + 4: 100 + # Issuer not certified for CVC/CVV + 5: 50 + # No CVC/CVV provided + 6: 50 diff --git a/config/amazon/main.yaml b/config/amazon/main.yaml new file mode 100644 index 0000000..b5d18b1 --- /dev/null +++ b/config/amazon/main.yaml @@ -0,0 +1,48 @@ +# Settings for Amazon Pay +# +# To override, create a file in: +# /etc/smashpig/amazon/main.yaml +# $HOME/.smashpig/amazon/main.yaml + +actions: + - SmashPig\PaymentProviders\Amazon\Actions\ReconstructMerchantReference + - SmashPig\PaymentProviders\Amazon\Actions\CloseOrderReference + - SmashPig\PaymentProviders\Amazon\Actions\AssociateRefundParent + - SmashPig\PaymentProviders\Amazon\Actions\AddMessageToQueue + +endpoints: + listener: + class: SmashPig\PaymentProviders\Amazon\AmazonListener + +credentials: &CREDENTIALS + # 13 or so uppercase letters + merchant_id: '' + # app or site-specific, starts with amznX.application + client_id: '' + # 20 alphanumeric characters + access_key: '' + # 40 base-64 encoded chars + secret_key: '' + # 'de', 'jp', 'uk', or 'us' + region: '' + sandbox: false + +# Override these to mock the Amazon SDK classes +payments-client: + class: PayWithAmazon\PaymentsClient + constructor-parameters: + - <<: *CREDENTIALS + +reports-client: + class: PayWithAmazon\ReportsClient + constructor-parameters: + - <<: *CREDENTIALS + +ipn-handler-class: PayWithAmazon\IpnHandler + +audit: + download-path: "" + archive-path: "" + file-types: + - SmashPig\PaymentProviders\Amazon\Audit\RefundReport + - SmashPig\PaymentProviders\Amazon\Audit\SettlementReport \ No newline at end of file diff --git a/config/dlocal/main.yaml b/config/dlocal/main.yaml new file mode 100644 index 0000000..74498d6 --- /dev/null +++ b/config/dlocal/main.yaml @@ -0,0 +1,16 @@ +# Settings for d*Local (formerly AstroPay) +# +# To override, create a file in: +# /etc/smashpig/dlocal/main.yaml +# $HOME/.smashpig/dlocal/main.yaml + +actions: + - SmashPig\Core\Actions\IncomingMessage + +endpoints: + listener: + class: SmashPig\PaymentProviders\AstroPay\AstroPayListener + +login: createlogin +secret: "secretkey" +charset: iso-8859-1 diff --git a/config/ingenico/main.yaml b/config/ingenico/main.yaml new file mode 100644 index 0000000..e901fc2 --- /dev/null +++ b/config/ingenico/main.yaml @@ -0,0 +1,46 @@ +# Settings for Ingenico (formerly GlobalCollect) +# +# To override, create a file in: +# /etc/smashpig/ingenico/main.yaml +# $HOME/.smashpig/ingenico/main.yaml + +actions: + - SmashPig\Core\Actions\IncomingMessage + +endpoints: + listener: + class: SmashPig\PaymentProviders\GlobalCollect\GlobalCollectListener + +api: + class: SmashPig\PaymentProviders\Ingenico\Api + constructor-parameters: + - 'https://api-sandbox.globalcollect.com/' + - 1234 # numeric merchant ID + +authenticator: + class: SmashPig\PaymentProviders\Ingenico\Authenticator + constructor-parameters: + - 'apiKey' + - 'apiSecret' + +payment-provider: + rtbt: + class: SmashPig\PaymentProviders\Ingenico\BankPaymentProvider + constructor-parameters: + - + cache-parameters: + duration: 900 + key-base: SMASHPIG_INGENICO_IDEAL_BANK_LIST + +ideal-status-provider: + class: SmashPig\PaymentProviders\Ingenico\BankPaymentProvider + constructor-parameters: + - + cache-parameters: + duration: 900 + key: SMASHPIG_IDEAL_BANK_STATUS + availability-url: https://availability.ideal.nl/api/api/GetIssuers + +curl: + validator: + class: SmashPig\PaymentProviders\Ingenico\RestResponseValidator diff --git a/config/main.yaml b/config/main.yaml index fa19ea9..4036eb2 100644 --- a/config/main.yaml +++ b/config/main.yaml @@ -1,478 +1,150 @@ -# Default values will be loaded at a lower priority than custom config. +# Global settings +# # To override, create a file in: # /etc/smashpig/main.yaml # $HOME/.smashpig/main.yaml # or edit this file if you're feeling cheeky, and be careful when upgrading. -default: - data-store: - redis: &REDIS - servers: - scheme: tcp - host: 127.0.0.1 - port: 6379 +data-store: + redis: &REDIS + servers: + scheme: tcp + host: 127.0.0.1 + port: 6379 - payments-antifraud: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: payments-antifraud - - pending: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: pending - - # FIXME: Consolidate these two backends - pending-db: - class: PDO - constructor-parameters: - - 'mysql:host=127.0.0.1;dbname=smashpig' - - damaged-db: - class: PDO - constructor-parameters: - - 'mysql:host=127.0.0.1;dbname=smashpig' - - fredge-db: - class: PDO - constructor-parameters: - - 'mysql:host=127.0.0.1;dbname=fredge' - - recurring: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: recurring - - refund: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: refund - - jobs-paypal: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - # FIXME: This queue thing is introspected at times, and at - # others not. Make it consistent (and invisible). - queue: jobs-paypal - - jobs-adyen: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: jobs-adyen - - donations: - class: PHPQueue\Backend\Predis - constructor-parameters: - - - <<: *REDIS - queue: donations - - logging: - root-context: SmashPig - # LOG_INFO - log-level: 6 - - enabled-log-streams: - - syslog - - log-streams: - syslog: - class: SmashPig\Core\Logging\LogStreams\SyslogLogStream - constructor-parameters: - # LOG_LOCAL0 - - 128 - # LOG_NDELAY - - 8 - - security: - ip-header-name: "" - ip-trusted-proxies: [] - ip-whitelist: [] - - endpoints: [] - - namespaces: [] - - include-files: [] - - include-paths: [] - - payment-provider: [] - - actions: [] - - email: - # TODO: Instead, format like: Name <email@domain> - from-address: - - sen...@contoso.com - - Example Sender - bounce-address: bounce+$1...@contoso.com - archive-addresses: [] - - maintenance: - job-runner: - time-limit: 60 - max-messages: 10 - - consume-pending: - time-limit: 60 - max-messages: 0 - - # in seconds - requeue-delay: 1200 - - requeue-max-age: 12000 - - curl: - wrapper: - class: SmashPig\Core\Http\CurlWrapper - validator: - class: SmashPig\Core\Http\HttpStatusValidator - timeout: 7 - retries: 3 - user-agent: SmashPig - - # Must implement Psr\Cache\CacheItemPoolInterface - # See PSR-6: http://www.php-fig.org/psr/psr-6/ - cache: - class: SmashPig\Core\Cache\HashCache - - -adyen: - logging: - root-context: SmashPig-Adyen - - endpoints: - listener: - class: SmashPig\PaymentProviders\Adyen\AdyenListener - - # FIXME: let's use this node to map payment methods to classes that - # implement doPayment (aka gateway adapters). See ingenico below. - payment-provider: - adyen: - api: - class: SmashPig\PaymentProviders\Adyen\AdyenPaymentsAPI - - payments-wsdl: https://pal-live.adyen.com/pal/Payment.wsdl - #payments-wsdl: https://pal-test.adyen.com/pal/Payment.wsdl - - accounts: {} - # FIXME: Provide sample account config more consistently. The - # empty map above is easy to overlook. - - # For each Adyen merchant account, add an entry like the - # following with the merchant account name as the key. - # The ws- credentials should be a user authorized to make - # API calls, and the report- credentials should be a user - # authorized to download reports. Reports will be - # downloaded to the location specified in report-location. - # - # At least one account and all subkeys are required. - # - # example-account-name: - # ws-username: "" - # ws-password: "" - # report-username: "" - # report-password: "" - # report-location: "/tmp" - - fraud-filters: - # Automatically capture authorizations under this score - review-threshold: 75 - # Automatically cancel authorizations with at least this score - reject-threshold: 125 - - # Authorization notifications include AVS and CVV result codes. - # The following maps set a risk score for each result code, which - # we combine with any risk score computed on the payment site to - # decide whether to capture the payment or leave it for review. - # https://docs.adyen.com/manuals/api-manual/payment-responses/additionaldata-payment-responses - avs-map: - # Unknown. This is often returned in non-AVS countries. - 0: 50 - # Address matches, postal code doesn't - 1: 75 - # Neither postal code nor address match - 2: 100 - # AVS unavailable - 3: 50 - # AVS not supported for this card type - 4: 50 - # No AVS data provided - 5: 50 - # Postal code matches, address doesn't match - 6: 75 - # Both postal code and address match - 7: 0 - # Address not checked, postal code unknown - 8: 50 - # Address matches, postal code unknown - 9: 25 - # Address doesn't match, postal code unknown - 10: 50 - # Postal code not checked, address unknown - 11: 75 - # Address matches, postal code not checked - 12: 50 - # Address doesn't match, postal code not checked - 13: 0 - # Postal code matches, address unknown - 14: 50 - # Postal code matches, address not checked - 15: 50 - # Postal code doesn't match, address unknown - 16: 75 - # Postal code doesn't match, address not checked - 17: 100 - # Neither postal code nor address were checked - 18: 25 - # Name and postal code matches - 19: 0 - # Name, address and postal code matches - 20: 0 - # Name and address matches - 21: 0 - # Name matches - 22: 50 - # Postal code matches, name doesn't match - 23: 50 - # Both postal code and address matches, name doesn't match - 24: 25 - # Address matches, name doesn't match - 25: 50 - # Neither postal code, address nor name matches - 26: 100 - - cvv-map: - # Unknown - 0: 100 - # Matches - 1: 0 - # Doesn't match - 2: 100 - # Not checked - 3: 50 - # No CVC/CVV provided, but was required - 4: 100 - # Issuer not certified for CVC/CVV - 5: 50 - # No CVC/CVV provided - 6: 50 - - actions: [] - -amazon: - actions: - - SmashPig\PaymentProviders\Amazon\Actions\ReconstructMerchantReference - - SmashPig\PaymentProviders\Amazon\Actions\CloseOrderReference - - SmashPig\PaymentProviders\Amazon\Actions\AssociateRefundParent - - SmashPig\PaymentProviders\Amazon\Actions\AddMessageToQueue - - endpoints: - listener: - class: SmashPig\PaymentProviders\Amazon\AmazonListener - - credentials: &CREDENTIALS - # 13 or so uppercase letters - merchant_id: '' - # app or site-specific, starts with amznX.application - client_id: '' - # 20 alphanumeric characters - access_key: '' - # 40 base-64 encoded chars - secret_key: '' - # 'de', 'jp', 'uk', or 'us' - region: '' - sandbox: false - - # Override these to mock the Amazon SDK classes - payments-client: - class: PayWithAmazon\PaymentsClient - constructor-parameters: - - <<: *CREDENTIALS - - reports-client: - class: PayWithAmazon\ReportsClient - constructor-parameters: - - <<: *CREDENTIALS - - ipn-handler-class: PayWithAmazon\IpnHandler - - audit: - download-path: "" - archive-path: "" - file-types: - - SmashPig\PaymentProviders\Amazon\Audit\RefundReport - - SmashPig\PaymentProviders\Amazon\Audit\SettlementReport - -astropay: - actions: - - SmashPig\Core\Actions\IncomingMessage - - endpoints: - listener: - class: SmashPig\PaymentProviders\AstroPay\AstroPayListener - - login: createlogin - secret: "secretkey" - charset: iso-8859-1 - -paypal: - api: - class: SmashPig\PaymentProviders\PayPal\PayPalPaymentsAPI - - endpoints: - listener: - class: SmashPig\PaymentProviders\PayPal\Listener - - # For testing, override with - # postback-url: https://ipnpb.sandbox.paypal.com/cgi-bin/webscr - postback-url: https://ipnpb.paypal.com/cgi-bin/webscr - - var_map: - payment_date: date # needs strtotime(payment_date) - # FIXME Recurring messages use non-normalized field names, for example: - txn_type: txn_type - parent_txn_id: gateway_parent_id - txn_id: gateway_txn_id - recurring_payment_id: subscr_id - recur_times: installments - subscr_id: subscr_id - # FIXME This is only true for refund messages. Where to represent? - #txn_id: gateway_refund_id - mc_currency: currency - # FIXME rename refund_type - reason_code: type - #test_ipn: # signals test mode - custom: contribution_tracking_id - rp_invoice_id: contribution_tracking_id - payer_email: email - first_name: first_name - last_name: last_name - # FIXME this used to get split up - address_street: street_address - address_city: city - address_state: state_province - address_country_code: country - address_zip: postal_code - residence_country: country - # FIXME this too - address_name: supplemental_address_1 - gateway: gateway - mc_gross: gross - mc_amount3: gross - amount3: gross - mc_fee: fee - - rejects: - txn_type: new_case - - # txn types defined here: - # https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id08CTB0S055Z - messages: - payment: - class: SmashPig\PaymentProviders\PayPal\PaymentMessage - queue: donations - valid_statuses: # TODO is this message type agnostic? - - Completed - - Reversed - txn_types: - - cart - - send_money - - web_accept - - merch_pmt - - express_checkout - - masspay - - virtual_terminal - - recurring: # new style recurring payments - class: SmashPig\PaymentProviders\PayPal\RecurringMessage - queue: recurring - txn_types: - - recurring_payment - - recurring_payment_expired - - recurring_payment_failed - - recurring_payment_profile_cancel - - recurring_payment_profile_created - - recurring_payment_skipped - - recurring_payment_suspended - - recurring_payment_suspended_due_to_max_failed_payment - - subscription: # old style recurring payments - class: SmashPig\PaymentProviders\PayPal\SubscriptionMessage - queue: recurring - txn_types: - - subscr_cancel - - subscr_eot - - subscr_failed - - subscr_modify - - subscr_signup - # the following mean we got money \o/ - - subscr_payment - - refund: - class: SmashPig\PaymentProviders\PayPal\RefundMessage - queue: refund - txn_types: - - adjustment - - refund - # FIXME: if case_type=chargeback, then txn_type might be blank - # and the message should go to the refund queue. - -ingenico: &INGENICO - actions: - - SmashPig\Core\Actions\IncomingMessage - - endpoints: - listener: - class: SmashPig\PaymentProviders\GlobalCollect\GlobalCollectListener - - api: - class: SmashPig\PaymentProviders\Ingenico\Api - constructor-parameters: - - 'https://api-sandbox.globalcollect.com/' - - 1234 # numeric merchant ID - - authenticator: - class: SmashPig\PaymentProviders\Ingenico\Authenticator - constructor-parameters: - - 'apiKey' - - 'apiSecret' - - payment-provider: - rtbt: - class: SmashPig\PaymentProviders\Ingenico\BankPaymentProvider - constructor-parameters: - - - cache-parameters: - duration: 900 - key-base: SMASHPIG_INGENICO_IDEAL_BANK_LIST - - ideal-status-provider: - class: SmashPig\PaymentProviders\Ingenico\BankPaymentProvider + payments-antifraud: + class: PHPQueue\Backend\Predis constructor-parameters: - - cache-parameters: - duration: 900 - key: SMASHPIG_IDEAL_BANK_STATUS - availability-url: https://availability.ideal.nl/api/api/GetIssuers + <<: *REDIS + queue: payments-antifraud - curl: - validator: - class: SmashPig\PaymentProviders\Ingenico\RestResponseValidator + pending: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + queue: pending -# deprecated, delete when projects using SmashPig rename adaptors -globalcollect: - <<: *INGENICO + # FIXME: Consolidate these two backends + pending-db: + class: PDO + constructor-parameters: + - 'mysql:host=127.0.0.1;dbname=smashpig' + + damaged-db: + class: PDO + constructor-parameters: + - 'mysql:host=127.0.0.1;dbname=smashpig' + + fredge-db: + class: PDO + constructor-parameters: + - 'mysql:host=127.0.0.1;dbname=fredge' + + recurring: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + queue: recurring + + refund: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + queue: refund + + jobs-paypal: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + # FIXME: This queue thing is introspected at times, and at + # others not. Make it consistent (and invisible). + queue: jobs-paypal + + jobs-adyen: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + queue: jobs-adyen + + donations: + class: PHPQueue\Backend\Predis + constructor-parameters: + - + <<: *REDIS + queue: donations + +logging: + root-context: SmashPig + # LOG_INFO + log-level: 6 + + enabled-log-streams: + - syslog + + log-streams: + syslog: + class: SmashPig\Core\Logging\LogStreams\SyslogLogStream + constructor-parameters: + # LOG_LOCAL0 + - 128 + # LOG_NDELAY + - 8 + +security: + ip-header-name: "" + ip-trusted-proxies: [] + ip-whitelist: [] + +endpoints: [] + +namespaces: [] + +include-files: [] + +include-paths: [] + +payment-provider: [] + +actions: [] + +email: + # TODO: Instead, format like: Name <email@domain> + from-address: + - sen...@contoso.com + - Example Sender + bounce-address: bounce+$1...@contoso.com + archive-addresses: [] + +maintenance: + job-runner: + time-limit: 60 + max-messages: 10 + + consume-pending: + time-limit: 60 + max-messages: 0 + +# in seconds +requeue-delay: 1200 + +requeue-max-age: 12000 + +curl: + wrapper: + class: SmashPig\Core\Http\CurlWrapper + validator: + class: SmashPig\Core\Http\HttpStatusValidator + timeout: 7 + retries: 3 + user-agent: SmashPig + +# Must implement Psr\Cache\CacheItemPoolInterface +# See PSR-6: http://www.php-fig.org/psr/psr-6/ +cache: + class: SmashPig\Core\Cache\HashCache diff --git a/config/paypal/main.yaml b/config/paypal/main.yaml new file mode 100644 index 0000000..cbd7aaf --- /dev/null +++ b/config/paypal/main.yaml @@ -0,0 +1,107 @@ +# Settings for PayPal +# +# To override, create a file in: +# /etc/smashpig/paypal/main.yaml +# $HOME/.smashpig/paypal/main.yaml + +api: + class: SmashPig\PaymentProviders\PayPal\PayPalPaymentsAPI + +endpoints: + listener: + class: SmashPig\PaymentProviders\PayPal\Listener + +# For testing, override with +# postback-url: https://ipnpb.sandbox.paypal.com/cgi-bin/webscr +postback-url: https://ipnpb.paypal.com/cgi-bin/webscr + +# TODO: merge this with DonationInterface style var_map +var_map: + payment_date: date # needs strtotime(payment_date) + # FIXME Recurring messages use non-normalized field names, for example: + txn_type: txn_type + parent_txn_id: gateway_parent_id + txn_id: gateway_txn_id + recurring_payment_id: subscr_id + recur_times: installments + subscr_id: subscr_id + # FIXME This is only true for refund messages. Where to represent? + #txn_id: gateway_refund_id + mc_currency: currency + # FIXME rename refund_type + reason_code: type + #test_ipn: # signals test mode + custom: contribution_tracking_id + rp_invoice_id: contribution_tracking_id + payer_email: email + first_name: first_name + last_name: last_name + # FIXME this used to get split up + address_street: street_address + address_city: city + address_state: state_province + address_country_code: country + address_zip: postal_code + residence_country: country + # FIXME this too + address_name: supplemental_address_1 + gateway: gateway + mc_gross: gross + mc_amount3: gross + amount3: gross + mc_fee: fee + +rejects: + txn_type: new_case + +# txn types defined here: +# https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id08CTB0S055Z +messages: + payment: + class: SmashPig\PaymentProviders\PayPal\PaymentMessage + queue: donations + valid_statuses: # TODO is this message type agnostic? + - Completed + - Reversed + txn_types: + - cart + - send_money + - web_accept + - merch_pmt + - express_checkout + - masspay + - virtual_terminal + + recurring: # new style recurring payments + class: SmashPig\PaymentProviders\PayPal\RecurringMessage + queue: recurring + txn_types: + - recurring_payment + - recurring_payment_expired + - recurring_payment_failed + - recurring_payment_profile_cancel + - recurring_payment_profile_created + - recurring_payment_skipped + - recurring_payment_suspended + - recurring_payment_suspended_due_to_max_failed_payment + + subscription: # old style recurring payments + class: SmashPig\PaymentProviders\PayPal\SubscriptionMessage + queue: recurring + txn_types: + - subscr_cancel + - subscr_eot + - subscr_failed + - subscr_modify + - subscr_signup + # the following mean we got money \o/ + - subscr_payment + + refund: + class: SmashPig\PaymentProviders\PayPal\RefundMessage + queue: refund + txn_types: + - adjustment + - refund + # FIXME: if case_type=chargeback, then txn_type might be blank + # and the message should go to the refund queue. -- To view, visit https://gerrit.wikimedia.org/r/355552 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6009e97e9875feea584c7baaa129bb3aea97ddd5 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/SmashPig Gerrit-Branch: master Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits