|
|
@@ -1,6 +1,7 @@
|
|
|
+import { PaymentMetadata } from '@vendure/core';
|
|
|
import { ConfigArgValues } from '@vendure/core/dist/common/configurable-operation';
|
|
|
import '@vendure/core/dist/entity/custom-entity-fields';
|
|
|
-import { Environment } from 'braintree';
|
|
|
+import { Environment, Transaction } from 'braintree';
|
|
|
|
|
|
import { braintreePaymentMethodHandler } from './braintree.handler';
|
|
|
|
|
|
@@ -39,4 +40,58 @@ export interface BraintreePluginOptions {
|
|
|
* @default false
|
|
|
*/
|
|
|
storeCustomersInBraintree?: boolean;
|
|
|
+ /**
|
|
|
+ * @description
|
|
|
+ * Allows you to configure exactly what information from the Braintree
|
|
|
+ * [Transaction object](https://developer.paypal.com/braintree/docs/reference/response/transaction#result-object] (which is returned by the
|
|
|
+ * `transaction.sale()` method of the SDK) should be persisted to the resulting Payment entity metadata.
|
|
|
+ *
|
|
|
+ * By default, the built-in extraction function will return a metadata object that looks like this:
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * ```TypeScript
|
|
|
+ * const metadata = {
|
|
|
+ * "status": "settling",
|
|
|
+ * "currencyIsoCode": "GBP",
|
|
|
+ * "merchantAccountId": "my_account_id",
|
|
|
+ * "cvvCheck": "Not Applicable",
|
|
|
+ * "avsPostCodeCheck": "Not Applicable",
|
|
|
+ * "avsStreetAddressCheck": "Not Applicable",
|
|
|
+ * "processorAuthorizationCode": null,
|
|
|
+ * "processorResponseText": "Approved",
|
|
|
+ * // for Paypal payments
|
|
|
+ * "paymentMethod": "paypal_account",
|
|
|
+ * "paypalData": {
|
|
|
+ * "payerEmail": "michael-buyer@paypalsandbox.com",
|
|
|
+ * "paymentId": "PAYID-MLCXYNI74301746XK8807043",
|
|
|
+ * "authorizationId": "3BU93594D85624939",
|
|
|
+ * "payerStatus": "VERIFIED",
|
|
|
+ * "sellerProtectionStatus": "ELIGIBLE",
|
|
|
+ * "transactionFeeAmount": "0.54"
|
|
|
+ * },
|
|
|
+ * // for credit card payments
|
|
|
+ * "paymentMethod": "credit_card",
|
|
|
+ * "cardData": {
|
|
|
+ * "cardType": "MasterCard",
|
|
|
+ * "last4": "5454",
|
|
|
+ * "expirationDate": "02/2023"
|
|
|
+ * }
|
|
|
+ * // publicly-available metadata that will be
|
|
|
+ * // readable from the Shop API
|
|
|
+ * "public": {
|
|
|
+ * "cardData": {
|
|
|
+ * "cardType": "MasterCard",
|
|
|
+ * "last4": "5454",
|
|
|
+ * "expirationDate": "02/2023"
|
|
|
+ * },
|
|
|
+ * "paypalData": {
|
|
|
+ * "authorizationId": "3BU93594D85624939",
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * ```
|
|
|
+ *
|
|
|
+ * @since 1.7.0
|
|
|
+ */
|
|
|
+ extractMetadata?: (transaction: Transaction) => PaymentMetadata;
|
|
|
}
|