Skip to content

Instantly share code, notes, and snippets.

@mipearson
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mipearson/9820589 to your computer and use it in GitHub Desktop.
Save mipearson/9820589 to your computer and use it in GitHub Desktop.
require 'spec_helper'
INPUT = <<-EOF
#<PayPal::SDK::Merchant::DataTypes::DoExpressCheckoutPaymentResponseType:0x007fe08b4ff4e8 @Timestamp=Thu, 27 Mar 2014 06:34:56 +0000, @Ack="PartialSuccess", @CorrelationID="XXXXX", @Version="98.0", @Build="10277387", @DoExpressCheckoutPaymentResponseDetails=#<PayPal::SDK::Merchant::DataTypes::DoExpressCheckoutPaymentResponseDetailsType:0x007fe08b4fee30 @Token="XXX", @PaymentInfo=[#<PayPal::SDK::Merchant::DataTypes::PaymentInfoType:0x007fe08b4feca0 @TransactionID=nil, @ParentTransactionID=nil, @ReceiptID=nil, @TransactionType="none", @PaymentType="none", @ExchangeRate=nil, @PaymentStatus="Failed", @PendingReason="none", @ReasonCode="none", @SellerDetails=#<PayPal::SDK::Merchant::DataTypes::SellerDetailsType:0x007fe08b4fe7c8 @PayPalAccountID="XXXXX", @SecureMerchantAccountID="XXXXX">, @PaymentRequestID="4444", @PaymentError=#<PayPal::SDK::Merchant::DataTypes::ErrorType:0x007fe08b4fe570 @ShortMessage="Transaction cannot complete.", @LongMessage="Instruct the customer to retry the transaction using an alternative payment method from the customers PayPal wallet. The transaction did not complete with the customers selected payment method.", @ErrorCode="10417", @SeverityCode="Error">>, #<PayPal::SDK::Merchant::DataTypes::PaymentInfoType:0x007fe08b4fe278 @TransactionID="XXXXX", @ParentTransactionID=nil, @ReceiptID="XXX", @TransactionType="cart", @PaymentType="instant", @ExchangeRate=nil, @PaymentStatus="Pending", @PendingReason="payment-review", @ReasonCode="none", @SellerDetails=#<PayPal::SDK::Merchant::DataTypes::SellerDetailsType:0x007fe08b4fd3a0 @PayPalAccountID="XXXX", @SecureMerchantAccountID="XXXXX">, @PaymentRequestID="5555", @PaymentDate=Thu, 27 Mar 2014 06:34:56 +0000, @GrossAmount=#<PayPal::SDK::Merchant::DataTypes::BasicAmountType:0x007fe08b4fdb70 @currencyID="AUD", @value="9999.99">, @FeeAmount=#<PayPal::SDK::Merchant::DataTypes::BasicAmountType:0x007fe08b4fd9e0 @currencyID="AUD", @value="99.99">, @TaxAmount=#<PayPal::SDK::Merchant::DataTypes::BasicAmountType:0x007fe08b4fd850 @currencyID="AUD", @value="0.00">, @ProtectionEligibility="Ineligible", @ProtectionEligibilityType="None">], @SuccessPageRedirectRequested="true", @CoupledPaymentInfo=[#<PayPal::SDK::Merchant::DataTypes::CoupledPaymentInfoType:0x007fe08b4fd008>]>, @Errors=[]>
EOF
EXPECTED = {
Timestamp: Time.parse("Thu, 27 Mar 2014 06:34:56 +0000"),
Ack: 'PartialSuccess',
CorrelationID: 'XXXXX',
Version: '98.0',
Build: '10277387',
DoExpressCheckoutPaymentResponseDetails: {
Token: 'XXX',
PaymentInfo: [
{
TransactionID: nil,
PaymentTransactionID: nil,
ReceiptID: nil,
TransactionType: 'none',
PaymentType: 'none',
ExchangeRate: nil,
PaymentStatus: "failed",
PendingReason: "none",
ReasonCode: "none",
SellerDetails: {
PayPalAccountID: 'XXXXX',
SecureMerchantAccountID: 'XXXXX',
},
PaymentRequestID: '4444',
PaymentError: {
ShortMessage: "Transaction cannot complete.",
LongMessage: "Instruct the customer to retry the transaction using an alternative payment method from the customers PayPal wallet. The transaction did not complete with the customers selected payment method.",
ErrorCode: "10417"
SeverityCode: 'Error'
}
},
{
TransactionID: 'XXXXX'
ParentTransactionID: nil,
ReceiptID: 'XXX',
TransactionType: 'cart',
PaymentType: 'instant',
ExchangeRate: nil,
PaymentStatus: 'Pending',
PendingReason: 'payment-review',
ReasonCode: 'none',
SellerDetails: {
PayPalAccountID: 'XXXXX',
SecureMerchantAccountID: 'XXXXX'
}
PaymentRequestID: '5555',
PaymentDate: Time.parse("Thu, 27 Mar 2014 06:34:56 +0000"),
GrossAmount: {
currencyID: 'AUD', value: '9999.99'
},
FeeAmount: {
currencyID: 'AUD', value: '99.99'
}
TaxAmount: {
currencyID: 'AUD', value: '0.00'
},
ProtectionEligibility: 'Ineligible',
ProtectionEligibilityType: 'None'
}
],
SuccessPageRedirectRequested: 'true'
CoupledPaymentInfo: [{}],
Errors: []
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment