arrow_payments 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +25 -0
 - data/.rspec +2 -0
 - data/.travis.yml +3 -0
 - data/Gemfile +3 -0
 - data/README.md +272 -0
 - data/Rakefile +10 -0
 - data/arrow_payments.gemspec +25 -0
 - data/lib/arrow_payments.rb +25 -0
 - data/lib/arrow_payments/address.rb +11 -0
 - data/lib/arrow_payments/client.rb +57 -0
 - data/lib/arrow_payments/client/customers.rb +45 -0
 - data/lib/arrow_payments/client/payment_methods.rb +90 -0
 - data/lib/arrow_payments/client/transactions.rb +64 -0
 - data/lib/arrow_payments/configuration.rb +7 -0
 - data/lib/arrow_payments/connection.rb +78 -0
 - data/lib/arrow_payments/customer.rb +38 -0
 - data/lib/arrow_payments/entity.rb +39 -0
 - data/lib/arrow_payments/errors.rb +13 -0
 - data/lib/arrow_payments/line_item.rb +10 -0
 - data/lib/arrow_payments/payment_method.rb +19 -0
 - data/lib/arrow_payments/recurring_billing.rb +30 -0
 - data/lib/arrow_payments/transaction.rb +74 -0
 - data/lib/arrow_payments/version.rb +3 -0
 - data/spec/arrow_payments_spec.rb +40 -0
 - data/spec/client_spec.rb +42 -0
 - data/spec/configuration_spec.rb +24 -0
 - data/spec/customer_spec.rb +29 -0
 - data/spec/customers_spec.rb +160 -0
 - data/spec/entity_spec.rb +55 -0
 - data/spec/fixtures/complete_payment_method.json +37 -0
 - data/spec/fixtures/customer.json +25 -0
 - data/spec/fixtures/customers.json +133 -0
 - data/spec/fixtures/headers/payment_method_complete.yml +9 -0
 - data/spec/fixtures/headers/payment_method_start.yml +9 -0
 - data/spec/fixtures/line_item.json +8 -0
 - data/spec/fixtures/start_payment_method.json +6 -0
 - data/spec/fixtures/transaction.json +29 -0
 - data/spec/fixtures/transaction_capture.json +5 -0
 - data/spec/fixtures/transactions.json +68 -0
 - data/spec/line_item_spec.rb +17 -0
 - data/spec/payment_method_spec.rb +16 -0
 - data/spec/payment_methods_spec.rb +181 -0
 - data/spec/recurring_billing_spec.rb +28 -0
 - data/spec/spec_helper.rb +19 -0
 - data/spec/transactions_spec.rb +101 -0
 - metadata +225 -0
 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
                "Name": "First Supplies",
         
     | 
| 
      
 3 
     | 
    
         
            +
                "Code": "First Supplies",
         
     | 
| 
      
 4 
     | 
    
         
            +
                "PrimaryContact": "John Peoples",
         
     | 
| 
      
 5 
     | 
    
         
            +
                "PrimaryContactPhone": "8325539616",
         
     | 
| 
      
 6 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "John.Peoples@arrow-test.com",
         
     | 
| 
      
 7 
     | 
    
         
            +
                "PaymentMethods": [{
         
     | 
| 
      
 8 
     | 
    
         
            +
                    "ID": 12436,
         
     | 
| 
      
 9 
     | 
    
         
            +
                    "CardType": "Visa",
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "Last4": "1111",
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "CardholderFirstName": "Paola",
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "CardholderLastName": "Chen",
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "ExpirationMonth": 6,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    "ExpirationYear": 2015,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    "BillingStreet1": "7495 Center St.",
         
     | 
| 
      
 16 
     | 
    
         
            +
                    "BillingStreet2": null,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    "BillingCity": "Chicago",
         
     | 
| 
      
 18 
     | 
    
         
            +
                    "BillingState": "IL",
         
     | 
| 
      
 19 
     | 
    
         
            +
                    "BillingZip": "60601"
         
     | 
| 
      
 20 
     | 
    
         
            +
                }],
         
     | 
| 
      
 21 
     | 
    
         
            +
                "RecurrentBilling": [],
         
     | 
| 
      
 22 
     | 
    
         
            +
                "ID": 10162,
         
     | 
| 
      
 23 
     | 
    
         
            +
                "Success": true,
         
     | 
| 
      
 24 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 25 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,133 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [{
         
     | 
| 
      
 2 
     | 
    
         
            +
                "Name": "First Supplies",
         
     | 
| 
      
 3 
     | 
    
         
            +
                "Code": "First Supplies",
         
     | 
| 
      
 4 
     | 
    
         
            +
                "PrimaryContact": "John Peoples",
         
     | 
| 
      
 5 
     | 
    
         
            +
                "PrimaryContactPhone": "8325539616",
         
     | 
| 
      
 6 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "John.Peoples@arrow-test.com",
         
     | 
| 
      
 7 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 8 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 9 
     | 
    
         
            +
                "ID": 10162,
         
     | 
| 
      
 10 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 11 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 12 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 13 
     | 
    
         
            +
                "Name": "Modular Cycle Systems",
         
     | 
| 
      
 14 
     | 
    
         
            +
                "Code": "Modular Cycle Systems",
         
     | 
| 
      
 15 
     | 
    
         
            +
                "PrimaryContact": "Kim Ralls",
         
     | 
| 
      
 16 
     | 
    
         
            +
                "PrimaryContactPhone": "2026266380",
         
     | 
| 
      
 17 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Kim.Ralls@arrow-test.com",
         
     | 
| 
      
 18 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 19 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 20 
     | 
    
         
            +
                "ID": 10163,
         
     | 
| 
      
 21 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 22 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 23 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 24 
     | 
    
         
            +
                "Name": "Camping and Sports Store",
         
     | 
| 
      
 25 
     | 
    
         
            +
                "Code": "Camping and Sports Store",
         
     | 
| 
      
 26 
     | 
    
         
            +
                "PrimaryContact": "Juanita Zimmerman",
         
     | 
| 
      
 27 
     | 
    
         
            +
                "PrimaryContactPhone": "2150722144",
         
     | 
| 
      
 28 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Juanita.Zimmerman@arrow-test.com",
         
     | 
| 
      
 29 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 30 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 31 
     | 
    
         
            +
                "ID": 10164,
         
     | 
| 
      
 32 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 33 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 34 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 35 
     | 
    
         
            +
                "Name": "Every Bike Shop",
         
     | 
| 
      
 36 
     | 
    
         
            +
                "Code": "Every Bike Shop",
         
     | 
| 
      
 37 
     | 
    
         
            +
                "PrimaryContact": "Steven Whitehead",
         
     | 
| 
      
 38 
     | 
    
         
            +
                "PrimaryContactPhone": "7382106362",
         
     | 
| 
      
 39 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Steven.Whitehead@arrow-test.com",
         
     | 
| 
      
 40 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 41 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 42 
     | 
    
         
            +
                "ID": 10165,
         
     | 
| 
      
 43 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 44 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 45 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 46 
     | 
    
         
            +
                "Name": "Mechanical Products Ltd.",
         
     | 
| 
      
 47 
     | 
    
         
            +
                "Code": "Mechanical Products Ltd.",
         
     | 
| 
      
 48 
     | 
    
         
            +
                "PrimaryContact": "Vincent White",
         
     | 
| 
      
 49 
     | 
    
         
            +
                "PrimaryContactPhone": "8919827226",
         
     | 
| 
      
 50 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Vincent.White@arrow-test.com",
         
     | 
| 
      
 51 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 52 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 53 
     | 
    
         
            +
                "ID": 10166,
         
     | 
| 
      
 54 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 55 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 56 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 57 
     | 
    
         
            +
                "Name": "Immediate Repair Shop",
         
     | 
| 
      
 58 
     | 
    
         
            +
                "Code": "Immediate Repair Shop",
         
     | 
| 
      
 59 
     | 
    
         
            +
                "PrimaryContact": "Cristian Osorio",
         
     | 
| 
      
 60 
     | 
    
         
            +
                "PrimaryContactPhone": "3070268109",
         
     | 
| 
      
 61 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Cristian.Osorio@arrow-test.com",
         
     | 
| 
      
 62 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 63 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 64 
     | 
    
         
            +
                "ID": 10167,
         
     | 
| 
      
 65 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 66 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 67 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 68 
     | 
    
         
            +
                "Name": "Precision Gears Inc.",
         
     | 
| 
      
 69 
     | 
    
         
            +
                "Code": "Precision Gears Inc.",
         
     | 
| 
      
 70 
     | 
    
         
            +
                "PrimaryContact": "Lionel Penuchot",
         
     | 
| 
      
 71 
     | 
    
         
            +
                "PrimaryContactPhone": "9274943653",
         
     | 
| 
      
 72 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Lionel.Penuchot@arrow-test.com",
         
     | 
| 
      
 73 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 74 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 75 
     | 
    
         
            +
                "ID": 10168,
         
     | 
| 
      
 76 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 77 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 78 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 79 
     | 
    
         
            +
                "Name": "Refined Department Stores",
         
     | 
| 
      
 80 
     | 
    
         
            +
                "Code": "Refined Department Stores",
         
     | 
| 
      
 81 
     | 
    
         
            +
                "PrimaryContact": "Tim O\u0027Brien",
         
     | 
| 
      
 82 
     | 
    
         
            +
                "PrimaryContactPhone": "3350573995",
         
     | 
| 
      
 83 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Tim.OBrien@arrow-test.com",
         
     | 
| 
      
 84 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 85 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 86 
     | 
    
         
            +
                "ID": 10169,
         
     | 
| 
      
 87 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 88 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 89 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 90 
     | 
    
         
            +
                "Name": "Cross-Country Riding Supplies",
         
     | 
| 
      
 91 
     | 
    
         
            +
                "Code": "Cross-Country Riding Supplies",
         
     | 
| 
      
 92 
     | 
    
         
            +
                "PrimaryContact": "Suchitra Mohan",
         
     | 
| 
      
 93 
     | 
    
         
            +
                "PrimaryContactPhone": "6370211901",
         
     | 
| 
      
 94 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Suchitra.Mohan@arrow-test.com",
         
     | 
| 
      
 95 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 96 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 97 
     | 
    
         
            +
                "ID": 10170,
         
     | 
| 
      
 98 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 99 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 100 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 101 
     | 
    
         
            +
                "Name": "Leading Sales & Repair",
         
     | 
| 
      
 102 
     | 
    
         
            +
                "Code": "Leading Sales & Repair",
         
     | 
| 
      
 103 
     | 
    
         
            +
                "PrimaryContact": "Michelle Rector",
         
     | 
| 
      
 104 
     | 
    
         
            +
                "PrimaryContactPhone": "9354104105",
         
     | 
| 
      
 105 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "Michelle.Rector@arrow-test.com",
         
     | 
| 
      
 106 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 107 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 108 
     | 
    
         
            +
                "ID": 10171,
         
     | 
| 
      
 109 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 110 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 111 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 112 
     | 
    
         
            +
                "Name": "sasha",
         
     | 
| 
      
 113 
     | 
    
         
            +
                "Code": "1",
         
     | 
| 
      
 114 
     | 
    
         
            +
                "PrimaryContact": "1",
         
     | 
| 
      
 115 
     | 
    
         
            +
                "PrimaryContactPhone": "1",
         
     | 
| 
      
 116 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "1",
         
     | 
| 
      
 117 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 118 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 119 
     | 
    
         
            +
                "ID": 10204,
         
     | 
| 
      
 120 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 121 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 122 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 123 
     | 
    
         
            +
                "Name": "Rachel ",
         
     | 
| 
      
 124 
     | 
    
         
            +
                "Code": "1234",
         
     | 
| 
      
 125 
     | 
    
         
            +
                "PrimaryContact": "Rachel",
         
     | 
| 
      
 126 
     | 
    
         
            +
                "PrimaryContactPhone": "(847) 345-7932",
         
     | 
| 
      
 127 
     | 
    
         
            +
                "PrimaryContactEmailAddress": "racheleblau@gmail.com",
         
     | 
| 
      
 128 
     | 
    
         
            +
                "PaymentMethods": null,
         
     | 
| 
      
 129 
     | 
    
         
            +
                "RecurrentBilling": null,
         
     | 
| 
      
 130 
     | 
    
         
            +
                "ID": 11630,
         
     | 
| 
      
 131 
     | 
    
         
            +
                "Success": false,
         
     | 
| 
      
 132 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 133 
     | 
    
         
            +
            }]
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
                "Account": "API Demo",
         
     | 
| 
      
 3 
     | 
    
         
            +
                "TransactionType": "sale",
         
     | 
| 
      
 4 
     | 
    
         
            +
                "TransactionTime": "\/Date(1334766980057)\/",
         
     | 
| 
      
 5 
     | 
    
         
            +
                "Level": 2,
         
     | 
| 
      
 6 
     | 
    
         
            +
                "TotalAmount": 303.00,
         
     | 
| 
      
 7 
     | 
    
         
            +
                "Description": null,
         
     | 
| 
      
 8 
     | 
    
         
            +
                "TransactionSource": "API",
         
     | 
| 
      
 9 
     | 
    
         
            +
                "Status": "Not Settled",
         
     | 
| 
      
 10 
     | 
    
         
            +
                "CaptureAmount": 0,
         
     | 
| 
      
 11 
     | 
    
         
            +
                "AuthorizationCode": "123456",
         
     | 
| 
      
 12 
     | 
    
         
            +
                "PaymentMethodID": 0,
         
     | 
| 
      
 13 
     | 
    
         
            +
                "CardholderFirstName": "line",
         
     | 
| 
      
 14 
     | 
    
         
            +
                "CardholderLastName": "items",
         
     | 
| 
      
 15 
     | 
    
         
            +
                "CardType": "Visa",
         
     | 
| 
      
 16 
     | 
    
         
            +
                "CardLast4": "1111",
         
     | 
| 
      
 17 
     | 
    
         
            +
                "CustomerPONumber": "1",
         
     | 
| 
      
 18 
     | 
    
         
            +
                "TaxAmount": 1.00,
         
     | 
| 
      
 19 
     | 
    
         
            +
                "ShippingAmount": 1.00,
         
     | 
| 
      
 20 
     | 
    
         
            +
                "Billing": null,
         
     | 
| 
      
 21 
     | 
    
         
            +
                "ShippingAddressID": 0,
         
     | 
| 
      
 22 
     | 
    
         
            +
                "Shipping": null,
         
     | 
| 
      
 23 
     | 
    
         
            +
                "CustomerID": 10162,
         
     | 
| 
      
 24 
     | 
    
         
            +
                "CustomerName": "First Supplies",
         
     | 
| 
      
 25 
     | 
    
         
            +
                "LineItems": null,
         
     | 
| 
      
 26 
     | 
    
         
            +
                "ID": 40023,
         
     | 
| 
      
 27 
     | 
    
         
            +
                "Success": true,
         
     | 
| 
      
 28 
     | 
    
         
            +
                "Message": null
         
     | 
| 
      
 29 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
                "TransactionCount": 2,
         
     | 
| 
      
 3 
     | 
    
         
            +
                "Transactions": [{
         
     | 
| 
      
 4 
     | 
    
         
            +
                    "Account": "API Demo",
         
     | 
| 
      
 5 
     | 
    
         
            +
                    "TransactionType": "sale",
         
     | 
| 
      
 6 
     | 
    
         
            +
                    "TransactionTime": "\/Date(1334766980057)\/",
         
     | 
| 
      
 7 
     | 
    
         
            +
                    "Level": 2,
         
     | 
| 
      
 8 
     | 
    
         
            +
                    "TotalAmount": 303.00,
         
     | 
| 
      
 9 
     | 
    
         
            +
                    "Description": null,
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "TransactionSource": "API",
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "Status": "Not Settled",
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "CaptureAmount": 0,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "AuthorizationCode": "123456",
         
     | 
| 
      
 14 
     | 
    
         
            +
                    "PaymentMethodID": 0,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    "CardholderFirstName": "line",
         
     | 
| 
      
 16 
     | 
    
         
            +
                    "CardholderLastName": "items",
         
     | 
| 
      
 17 
     | 
    
         
            +
                    "CardType": "Visa",
         
     | 
| 
      
 18 
     | 
    
         
            +
                    "CardLast4": "1111",
         
     | 
| 
      
 19 
     | 
    
         
            +
                    "CustomerPONumber": "1",
         
     | 
| 
      
 20 
     | 
    
         
            +
                    "TaxAmount": 1.00,
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "ShippingAmount": 1.00,
         
     | 
| 
      
 22 
     | 
    
         
            +
                    "Billing": null,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "ShippingAddressID": 0,
         
     | 
| 
      
 24 
     | 
    
         
            +
                    "Shipping": null,
         
     | 
| 
      
 25 
     | 
    
         
            +
                    "CustomerID": 10162,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    "CustomerName": "First Supplies",
         
     | 
| 
      
 27 
     | 
    
         
            +
                    "LineItems": null,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    "ID": 40023,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    "Success": true,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    "Message": null
         
     | 
| 
      
 31 
     | 
    
         
            +
                }, {
         
     | 
| 
      
 32 
     | 
    
         
            +
                    "Account": "API Demo",
         
     | 
| 
      
 33 
     | 
    
         
            +
                    "TransactionType": "sale",
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "TransactionTime": "\/Date(1354824875023)\/",
         
     | 
| 
      
 35 
     | 
    
         
            +
                    "Level": 2,
         
     | 
| 
      
 36 
     | 
    
         
            +
                    "TotalAmount": 2002.00,
         
     | 
| 
      
 37 
     | 
    
         
            +
                    "Description": "Test",
         
     | 
| 
      
 38 
     | 
    
         
            +
                    "TransactionSource": "API",
         
     | 
| 
      
 39 
     | 
    
         
            +
                    "Status": "Not Settled",
         
     | 
| 
      
 40 
     | 
    
         
            +
                    "CaptureAmount": 0,
         
     | 
| 
      
 41 
     | 
    
         
            +
                    "AuthorizationCode": "123456",
         
     | 
| 
      
 42 
     | 
    
         
            +
                    "PaymentMethodID": 12436,
         
     | 
| 
      
 43 
     | 
    
         
            +
                    "CardholderFirstName": "Paola",
         
     | 
| 
      
 44 
     | 
    
         
            +
                    "CardholderLastName": "Chen",
         
     | 
| 
      
 45 
     | 
    
         
            +
                    "CardType": "Visa",
         
     | 
| 
      
 46 
     | 
    
         
            +
                    "CardLast4": "1111",
         
     | 
| 
      
 47 
     | 
    
         
            +
                    "CustomerPONumber": null,
         
     | 
| 
      
 48 
     | 
    
         
            +
                    "TaxAmount": 0.00,
         
     | 
| 
      
 49 
     | 
    
         
            +
                    "ShippingAmount": 0.00,
         
     | 
| 
      
 50 
     | 
    
         
            +
                    "Billing": {
         
     | 
| 
      
 51 
     | 
    
         
            +
                        "Address1": "7495 Center St.",
         
     | 
| 
      
 52 
     | 
    
         
            +
                        "Address2": null,
         
     | 
| 
      
 53 
     | 
    
         
            +
                        "City": "Chicago",
         
     | 
| 
      
 54 
     | 
    
         
            +
                        "State": "IL",
         
     | 
| 
      
 55 
     | 
    
         
            +
                        "Postal": "60601",
         
     | 
| 
      
 56 
     | 
    
         
            +
                        "Phone": null,
         
     | 
| 
      
 57 
     | 
    
         
            +
                        "Tag": "Chen"
         
     | 
| 
      
 58 
     | 
    
         
            +
                    },
         
     | 
| 
      
 59 
     | 
    
         
            +
                    "ShippingAddressID": 0,
         
     | 
| 
      
 60 
     | 
    
         
            +
                    "Shipping": null,
         
     | 
| 
      
 61 
     | 
    
         
            +
                    "CustomerID": 10162,
         
     | 
| 
      
 62 
     | 
    
         
            +
                    "CustomerName": "First Supplies",
         
     | 
| 
      
 63 
     | 
    
         
            +
                    "LineItems": null,
         
     | 
| 
      
 64 
     | 
    
         
            +
                    "ID": 391397,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    "Success": true,
         
     | 
| 
      
 66 
     | 
    
         
            +
                    "Message": null
         
     | 
| 
      
 67 
     | 
    
         
            +
                }]
         
     | 
| 
      
 68 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ArrowPayments::LineItem do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it { should respond_to :id }
         
     | 
| 
      
 5 
     | 
    
         
            +
              it { should respond_to :commodity_code }
         
     | 
| 
      
 6 
     | 
    
         
            +
              it { should respond_to :description }
         
     | 
| 
      
 7 
     | 
    
         
            +
              it { should respond_to :price }
         
     | 
| 
      
 8 
     | 
    
         
            +
              it { should respond_to :product_code }
         
     | 
| 
      
 9 
     | 
    
         
            +
              it { should respond_to :unit_of_measure }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              describe '#to_source_hash' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                it 'returns a formatted hash' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  item = ArrowPayments::LineItem.new(json_fixture('line_item.json'))
         
     | 
| 
      
 14 
     | 
    
         
            +
                  item.to_source_hash.should eq(json_fixture('line_item.json'))
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ArrowPayments::PaymentMethod do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it { should respond_to :id }
         
     | 
| 
      
 5 
     | 
    
         
            +
              it { should respond_to :card_type }
         
     | 
| 
      
 6 
     | 
    
         
            +
              it { should respond_to :last_digits }
         
     | 
| 
      
 7 
     | 
    
         
            +
              it { should respond_to :first_name }
         
     | 
| 
      
 8 
     | 
    
         
            +
              it { should respond_to :last_name }
         
     | 
| 
      
 9 
     | 
    
         
            +
              it { should respond_to :expiration_month }
         
     | 
| 
      
 10 
     | 
    
         
            +
              it { should respond_to :expiration_year }
         
     | 
| 
      
 11 
     | 
    
         
            +
              it { should respond_to :address }
         
     | 
| 
      
 12 
     | 
    
         
            +
              it { should respond_to :address2 }
         
     | 
| 
      
 13 
     | 
    
         
            +
              it { should respond_to :city }
         
     | 
| 
      
 14 
     | 
    
         
            +
              it { should respond_to :state }
         
     | 
| 
      
 15 
     | 
    
         
            +
              it { should respond_to :zip }
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,181 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ArrowPayments::PaymentMethods do
         
     | 
| 
      
 4 
     | 
    
         
            +
              let(:client) { ArrowPayments.client }
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              before :all do
         
     | 
| 
      
 7 
     | 
    
         
            +
                ArrowPayments::Configuration.api_key = 'foobar'
         
     | 
| 
      
 8 
     | 
    
         
            +
                ArrowPayments::Configuration.merchant_id = 'foo'
         
     | 
| 
      
 9 
     | 
    
         
            +
                ArrowPayments::Configuration.mode = 'sandbox'
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              describe '#start_payment_method' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                it 'raises error if customer does not exist' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/start").
         
     | 
| 
      
 15 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 16 
     | 
    
         
            +
                      :body => "{\"CustomerId\":11843,\"BillingAddress\":{},\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 17 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 18 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 19 
     | 
    
         
            +
                    to_return(:status => 404, :body => "", :headers => {:error => "Invalid customer"})
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  expect { client.start_payment_method(11843, {}) }.
         
     | 
| 
      
 22 
     | 
    
         
            +
                    to raise_error ArrowPayments::NotFound, "Invalid customer"
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                it 'raises error if address is not valid' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/start").
         
     | 
| 
      
 27 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 28 
     | 
    
         
            +
                      :body => "{\"CustomerId\":11843,\"BillingAddress\":{},\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 29 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 30 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 31 
     | 
    
         
            +
                    to_return(:status => 500, :body => "", :headers => {:error => "Something went wrong"})
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  expect { client.start_payment_method(11843, {}) }.
         
     | 
| 
      
 34 
     | 
    
         
            +
                    to raise_error ArrowPayments::Error
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                it 'returns submit form url' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  address = {
         
     | 
| 
      
 39 
     | 
    
         
            +
                    :address  => '3128 N Broadway',
         
     | 
| 
      
 40 
     | 
    
         
            +
                    :address2 => "Upstairs",
         
     | 
| 
      
 41 
     | 
    
         
            +
                    :city     => 'Chicago',
         
     | 
| 
      
 42 
     | 
    
         
            +
                    :state    => 'IL',
         
     | 
| 
      
 43 
     | 
    
         
            +
                    :zip      => '60657',
         
     | 
| 
      
 44 
     | 
    
         
            +
                    :phone    => '123123123'
         
     | 
| 
      
 45 
     | 
    
         
            +
                  }
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/start").
         
     | 
| 
      
 48 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 49 
     | 
    
         
            +
                      :body => "{\"CustomerId\":11843,\"BillingAddress\":{\"Address1\":\"3128 N Broadway\",\"Address2\":\"Upstairs\",\"City\":\"Chicago\",\"State\":\"IL\",\"Postal\":\"60657\",\"Phone\":\"123123123\"},\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 50 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 51 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 52 
     | 
    
         
            +
                    to_return(:status => 200, :body => fixture('start_payment_method.json'), :headers => {})
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  url = client.start_payment_method(11843, address)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  url.should eq('https://secure.nmi.com/api/v2/three-step/4i873m0s')
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              describe '#setup_payment_method' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                it 'return token to complete payment' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                  url = 'https://secure.nmi.com/api/v2/three-step/4i873m0s'
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                  card = {
         
     | 
| 
      
 64 
     | 
    
         
            +
                    :first_name       => 'John',
         
     | 
| 
      
 65 
     | 
    
         
            +
                    :last_name        => 'Doe',
         
     | 
| 
      
 66 
     | 
    
         
            +
                    :number           => '4111111111111111',
         
     | 
| 
      
 67 
     | 
    
         
            +
                    :security_code    => '123',
         
     | 
| 
      
 68 
     | 
    
         
            +
                    :expiration_month => 12,
         
     | 
| 
      
 69 
     | 
    
         
            +
                    :expiration_year  => 14
         
     | 
| 
      
 70 
     | 
    
         
            +
                  }
         
     | 
| 
      
 71 
     | 
    
         
            +
                  
         
     | 
| 
      
 72 
     | 
    
         
            +
                  stub_request(:post, "https://secure.nmi.com/api/v2/three-step/4i873m0s").
         
     | 
| 
      
 73 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 74 
     | 
    
         
            +
                      :body => {"billing-cc-exp"=>"1214", "billing-cc-number"=>"4111111111111111", "billing-cvv"=>"123", "billing-first-name"=>"John", "billing-last-name"=>"Doe"},
         
     | 
| 
      
 75 
     | 
    
         
            +
                      :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 76 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 77 
     | 
    
         
            +
                    to_return(
         
     | 
| 
      
 78 
     | 
    
         
            +
                      :status => 200, 
         
     | 
| 
      
 79 
     | 
    
         
            +
                      :body => "", 
         
     | 
| 
      
 80 
     | 
    
         
            +
                      :headers => {:location => 'http://arrowdemo.cloudapp.net/api/echo?token-id=4i873m0s'}
         
     | 
| 
      
 81 
     | 
    
         
            +
                    )
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  token = client.setup_payment_method(url, card)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  token.should eq('4i873m0s')
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              describe '#complete_payment_method' do
         
     | 
| 
      
 89 
     | 
    
         
            +
                it 'returns a newly created payment method' do
         
     | 
| 
      
 90 
     | 
    
         
            +
                  token = '4i873m0s'
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/complete").
         
     | 
| 
      
 93 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 94 
     | 
    
         
            +
                      :body => "{\"TokenID\":\"4i873m0s\",\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 95 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 96 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 97 
     | 
    
         
            +
                    to_return(:status => 200, :body => fixture('complete_payment_method.json'), :headers => {})
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  card = client.complete_payment_method(token)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  card.should be_a ArrowPayments::PaymentMethod
         
     | 
| 
      
 101 
     | 
    
         
            +
                  card.id.should eq(14240)
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              describe '#create_payment_method' do
         
     | 
| 
      
 106 
     | 
    
         
            +
                it 'return a newly created payment method' do
         
     | 
| 
      
 107 
     | 
    
         
            +
                  customer_id = 11843
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                  address = {
         
     | 
| 
      
 110 
     | 
    
         
            +
                    :address  => '3128 N Broadway',
         
     | 
| 
      
 111 
     | 
    
         
            +
                    :address2 => "Upstairs",
         
     | 
| 
      
 112 
     | 
    
         
            +
                    :city     => 'Chicago',
         
     | 
| 
      
 113 
     | 
    
         
            +
                    :state    => 'IL',
         
     | 
| 
      
 114 
     | 
    
         
            +
                    :zip      => '60657',
         
     | 
| 
      
 115 
     | 
    
         
            +
                    :phone    => '123123123'
         
     | 
| 
      
 116 
     | 
    
         
            +
                  }
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                  card = {
         
     | 
| 
      
 119 
     | 
    
         
            +
                    :first_name       => 'John',
         
     | 
| 
      
 120 
     | 
    
         
            +
                    :last_name        => 'Doe',
         
     | 
| 
      
 121 
     | 
    
         
            +
                    :number           => '4111111111111111',
         
     | 
| 
      
 122 
     | 
    
         
            +
                    :security_code    => '123',
         
     | 
| 
      
 123 
     | 
    
         
            +
                    :expiration_month => 12,
         
     | 
| 
      
 124 
     | 
    
         
            +
                    :expiration_year  => 14
         
     | 
| 
      
 125 
     | 
    
         
            +
                  }
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/start").
         
     | 
| 
      
 128 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 129 
     | 
    
         
            +
                      :body => "{\"CustomerId\":11843,\"BillingAddress\":{\"Address1\":\"3128 N Broadway\",\"Address2\":\"Upstairs\",\"City\":\"Chicago\",\"State\":\"IL\",\"Postal\":\"60657\",\"Phone\":\"123123123\"},\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 130 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 131 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 132 
     | 
    
         
            +
                    to_return(:status => 200, :body => fixture('start_payment_method.json'), :headers => {})
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                  stub_request(:post, "https://secure.nmi.com/api/v2/three-step/4i873m0s").
         
     | 
| 
      
 135 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 136 
     | 
    
         
            +
                      :body => {"billing-cc-exp"=>"1214", "billing-cc-number"=>"4111111111111111", "billing-cvv"=>"123", "billing-first-name"=>"John", "billing-last-name"=>"Doe"},
         
     | 
| 
      
 137 
     | 
    
         
            +
                      :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 138 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 139 
     | 
    
         
            +
                    to_return(
         
     | 
| 
      
 140 
     | 
    
         
            +
                      :status => 200, 
         
     | 
| 
      
 141 
     | 
    
         
            +
                      :body => "", 
         
     | 
| 
      
 142 
     | 
    
         
            +
                      :headers => {:location => 'http://arrowdemo.cloudapp.net/api/echo?token-id=4i873m0s'}
         
     | 
| 
      
 143 
     | 
    
         
            +
                    )
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/complete").
         
     | 
| 
      
 146 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 147 
     | 
    
         
            +
                      :body => "{\"TokenID\":\"4i873m0s\",\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 148 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 149 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 150 
     | 
    
         
            +
                    to_return(:status => 200, :body => fixture('complete_payment_method.json'), :headers => {})
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
                  card = client.create_payment_method(customer_id, address, card)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  card.id.should eq(14240)
         
     | 
| 
      
 154 
     | 
    
         
            +
                end
         
     | 
| 
      
 155 
     | 
    
         
            +
              end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
              describe '#destroy_payment_method' do
         
     | 
| 
      
 158 
     | 
    
         
            +
                it 'raises error if payment method does not exist' do
         
     | 
| 
      
 159 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/delete").
         
     | 
| 
      
 160 
     | 
    
         
            +
                    with(
         
     | 
| 
      
 161 
     | 
    
         
            +
                      :body => "{\"PaymentMethodId\":12345,\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 162 
     | 
    
         
            +
                      :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 163 
     | 
    
         
            +
                    ).
         
     | 
| 
      
 164 
     | 
    
         
            +
                    to_return(:status => 404, :body => "", :headers => {:error => 'Payment Method Not Found'})
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                  expect { client.delete_payment_method(12345) }.
         
     | 
| 
      
 167 
     | 
    
         
            +
                    to raise_error ArrowPayments::NotFound, 'Payment Method Not Found'
         
     | 
| 
      
 168 
     | 
    
         
            +
                end
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                it 'returns true if payment methods was deleted' do
         
     | 
| 
      
 171 
     | 
    
         
            +
                  stub_request(:post, "http://demo.arrowpayments.com/api/paymentmethod/delete").
         
     | 
| 
      
 172 
     | 
    
         
            +
                  with(
         
     | 
| 
      
 173 
     | 
    
         
            +
                    :body => "{\"PaymentMethodId\":12345,\"ApiKey\":\"foobar\",\"MID\":\"foo\"}",
         
     | 
| 
      
 174 
     | 
    
         
            +
                    :headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}
         
     | 
| 
      
 175 
     | 
    
         
            +
                  ).
         
     | 
| 
      
 176 
     | 
    
         
            +
                  to_return(:status => 200, :body => {'Success' => true}.to_json, :headers => {})
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
                  client.delete_payment_method(12345).should be_true
         
     | 
| 
      
 179 
     | 
    
         
            +
                end
         
     | 
| 
      
 180 
     | 
    
         
            +
              end 
         
     | 
| 
      
 181 
     | 
    
         
            +
            end
         
     |