From 7d49e536f4fa8e8b3481b10d6a38c2189a868741 Mon Sep 17 00:00:00 2001 From: Magno Date: Fri, 17 Mar 2023 14:57:48 -0300 Subject: [PATCH] Pending update (#90) Co-authored-by: Unknown --- README.md | 4793 +++++++++++------ composer.json | 3 +- phpunit.xml | 20 + src/Controllers/BaseController.php | 20 +- src/Controllers/ChargesController.php | 551 +- src/Controllers/CustomersController.php | 1085 +++- src/Controllers/InvoicesController.php | 331 +- src/Controllers/OrdersController.php | 486 +- src/Controllers/PlansController.php | 522 +- src/Controllers/RecipientsController.php | 855 ++- src/Controllers/SubscriptionsController.php | 1921 +++++-- src/Controllers/TokensController.php | 90 +- src/Controllers/TransactionsController.php | 27 +- src/Controllers/TransfersController.php | 91 +- src/Models/Address.php | 215 + src/Models/Address1.php | 150 + src/Models/ApplePay.php | 87 + src/Models/Authentication.php | 57 + src/Models/Authentication2.php | 57 + src/Models/BankAccount.php | 209 + src/Models/BankAccount1.php | 154 + src/Models/BankTransfer.php | 46 + src/Models/BankTransfer1.php | 56 + src/Models/BankTransfer2.php | 56 + src/Models/BillingAddress.php | 139 + src/Models/BillingAddress1.php | 150 + src/Models/Billingaddress3.php | 215 + src/Models/Boleto1.php | 150 + src/Models/CancelSplitRequest.php | 14 +- src/Models/Card.php | 219 + src/Models/Card1.php | 200 + src/Models/Card11.php | 109 + src/Models/Card9.php | 121 + src/Models/Charge.php | 258 + src/Models/ChargesCaptureRequest.php | 75 + src/Models/ChargesCaptureResponse.php | 258 + src/Models/ChargesCardRequest.php | 78 + src/Models/ChargesCardResponse.php | 258 + src/Models/ChargesConfirmPaymentResponse.php | 258 + src/Models/ChargesDueDateRequest.php | 49 + src/Models/ChargesDueDateResponse.php | 258 + src/Models/ChargesMetadataRequest.php | 46 + src/Models/ChargesMetadataResponse.php | 258 + src/Models/ChargesPaymentMethodRequest.php | 132 + src/Models/ChargesPaymentMethodResponse.php | 258 + src/Models/ChargesRequest.php | 75 + src/Models/ChargesRequest1.php | 131 + src/Models/ChargesResponse.php | 258 + src/Models/ChargesResponse2.php | 56 + src/Models/ChargesRetryResponse.php | 258 + src/Models/ChargesTransactionsResponse.php | 56 + src/Models/Checkout.php | 207 + src/Models/Contactless.php | 75 + src/Models/CreateApplePayRequest.php | 14 +- src/Models/CreateBoletoPaymentRequest.php | 30 +- .../CreateCancelSubscriptionRequest.php | 10 +- .../CreateCardPaymentContactlessRequest.php | 14 +- src/Models/CreateCardRequest.php | 80 +- src/Models/CreateChargeRequest.php | 12 +- ...CreateCheckoutCreditCardPaymentRequest.php | 13 +- .../CreateCheckoutDebitCardPaymentRequest.php | 9 +- src/Models/CreateCheckoutPaymentRequest.php | 77 +- src/Models/CreateCreditCardPaymentRequest.php | 48 +- src/Models/CreateCustomerRequest.php | 24 +- src/Models/CreateDebitCardPaymentRequest.php | 30 +- src/Models/CreateEmvDataDecryptRequest.php | 2 +- src/Models/CreateGooglePayRequest.php | 14 +- src/Models/CreateOrderRequest.php | 92 +- .../CreatePaymentAuthenticationRequest.php | 8 +- src/Models/CreatePaymentRequest.php | 73 +- src/Models/CreatePhonesRequest.php | 8 +- src/Models/CreatePlanItemRequest.php | 16 +- src/Models/CreatePlanRequest.php | 40 +- .../CreatePrivateLabelPaymentRequest.php | 24 +- src/Models/CreateRecipientRequest.php | 56 +- src/Models/CreateSetupRequest.php | 10 +- src/Models/CreateShippingRequest.php | 22 +- src/Models/CreateSplitRequest.php | 12 +- src/Models/CreateSubMerchantRequest.php | 24 +- src/Models/CreateSubscriptionItemRequest.php | 22 +- src/Models/CreateSubscriptionRequest.php | 42 +- src/Models/CreateTokenRequest.php | 20 +- src/Models/CreateVoucherPaymentRequest.php | 14 +- src/Models/CreditCard1.php | 187 + src/Models/CreditCard2.php | 73 + src/Models/CurrentCycle.php | 145 + src/Models/Customer.php | 193 + src/Models/Customer8.php | 135 + src/Models/CustomersAccessTokensRequest.php | 46 + src/Models/CustomersAccessTokensResponse.php | 88 + src/Models/CustomersAccessTokensResponse1.php | 56 + src/Models/CustomersAddressesRequest.php | 150 + src/Models/CustomersAddressesRequest1.php | 77 + src/Models/CustomersAddressesResponse.php | 56 + src/Models/CustomersAddressesResponse1.php | 215 + src/Models/CustomersCardsRenewResponse.php | 219 + src/Models/CustomersCardsRequest.php | 200 + src/Models/CustomersCardsRequest1.php | 111 + src/Models/CustomersCardsResponse.php | 219 + src/Models/CustomersCardsResponse1.php | 56 + src/Models/CustomersMetadataRequest.php | 46 + src/Models/CustomersMetadataResponse.php | 193 + src/Models/CustomersRequest.php | 127 + src/Models/CustomersRequest1.php | 135 + src/Models/CustomersResponse.php | 193 + src/Models/CustomersResponse3.php | 56 + src/Models/Cycle.php | 145 + src/Models/DebitCard1.php | 112 + src/Models/DebitCard2.php | 56 + src/Models/DefaultBankAccount.php | 209 + src/Models/DefaultBankAccount1.php | 154 + src/Models/Device.php | 45 + src/Models/Device1.php | 45 + src/Models/Fine.php | 66 + src/Models/GatewayResponse.php | 56 + src/Models/GetAccessTokenResponse.php | 12 +- src/Models/GetAddressResponse.php | 36 +- src/Models/GetAnticipationLimitsResponse.php | 12 +- src/Models/GetAnticipationResponse.php | 24 +- src/Models/GetBalanceResponse.php | 14 +- src/Models/GetBankAccountResponse.php | 36 +- src/Models/GetBoletoTransactionResponse.php | 34 +- src/Models/GetCardResponse.php | 38 +- src/Models/GetChargeResponse.php | 12 +- .../GetCheckoutCreditCardPaymentResponse.php | 11 +- .../GetCheckoutDebitCardPaymentResponse.php | 9 +- src/Models/GetCheckoutPaymentResponse.php | 114 +- .../GetCheckoutPaymentSettingsResponse.php | 20 +- .../GetCreditCardTransactionResponse.php | 28 +- src/Models/GetCustomerResponse.php | 32 +- .../GetDebitCardTransactionResponse.php | 32 +- src/Models/GetDiscountResponse.php | 2 +- src/Models/GetIncrementResponse.php | 2 +- src/Models/GetInvoiceItemResponse.php | 18 +- src/Models/GetInvoiceResponse.php | 56 +- src/Models/GetOrderResponse.php | 48 +- .../GetPaymentAuthenticationResponse.php | 8 +- src/Models/GetPixPayerResponse.php | 11 +- src/Models/GetPixTransactionResponse.php | 13 +- src/Models/GetPlanItemResponse.php | 26 +- .../GetPrivateLabelTransactionResponse.php | 26 +- src/Models/GetRecipientResponse.php | 110 +- src/Models/GetShippingResponse.php | 18 +- src/Models/GetSplitResponse.php | 6 +- src/Models/GetSubscriptionItemResponse.php | 28 +- src/Models/GetSubscriptionResponse.php | 69 +- src/Models/GetTokenResponse.php | 12 +- src/Models/GetTransactionResponse.php | 48 +- src/Models/GetTransfer.php | 8 +- src/Models/GetTransferResponse.php | 18 +- src/Models/GetUsageResponse.php | 2 +- src/Models/GetUsagesDetailsResponse.php | 20 +- src/Models/GetVoucherTransactionResponse.php | 24 +- src/Models/GooglePay.php | 87 + src/Models/Header.php | 67 + src/Models/Header1.php | 47 + src/Models/Interest.php | 66 + src/Models/Invoice.php | 278 + src/Models/InvoicesMetadataRequest.php | 46 + src/Models/InvoicesMetadataResponse.php | 278 + src/Models/InvoicesResponse.php | 278 + src/Models/InvoicesResponse2.php | 56 + src/Models/InvoicesStatusResponse.php | 278 + src/Models/ListAccessTokensResponse.php | 8 +- src/Models/ListAddressesResponse.php | 8 +- src/Models/ListAnticipationResponse.php | 8 +- src/Models/ListCardsResponse.php | 8 +- src/Models/ListChargeTransactionsResponse.php | 8 +- src/Models/ListChargesResponse.php | 8 +- src/Models/ListCustomersResponse.php | 8 +- src/Models/ListCyclesResponse.php | 8 +- src/Models/ListDiscountsResponse.php | 8 +- src/Models/ListIncrementsResponse.php | 8 +- src/Models/ListInvoicesResponse.php | 8 +- src/Models/ListOrderResponse.php | 8 +- src/Models/ListPlansResponse.php | 8 +- src/Models/ListRecipientResponse.php | 8 +- src/Models/ListSubscriptionItemsResponse.php | 8 +- src/Models/ListSubscriptionsResponse.php | 8 +- src/Models/ListTransactionsFilesResponse.php | 8 +- src/Models/ListTransactionsResponse.php | 8 +- src/Models/ListTransferResponse.php | 8 +- src/Models/ListTransfers.php | 8 +- src/Models/ListUsagesDetailsResponse.php | 8 +- src/Models/ListUsagesResponse.php | 8 +- src/Models/ListWithdrawals.php | 8 +- src/Models/Location.php | 56 + src/Models/Max.php | 57 + src/Models/Min.php | 57 + src/Models/Options1.php | 48 + src/Models/Options2.php | 65 + src/Models/Order.php | 217 + src/Models/OrdersClosedResponse.php | 217 + src/Models/OrdersItemsRequest.php | 85 + src/Models/OrdersItemsRequest1.php | 76 + src/Models/OrdersItemsResponse.php | 217 + src/Models/OrdersItemsResponse1.php | 96 + src/Models/OrdersMetadataRequest.php | 46 + src/Models/OrdersMetadataResponse.php | 217 + src/Models/OrdersRequest.php | 190 + src/Models/OrdersResponse.php | 56 + src/Models/OrdersResponse1.php | 217 + src/Models/Paging.php | 66 + src/Models/Payment.php | 198 + src/Models/Period.php | 145 + src/Models/Pix.php | 69 + src/Models/Plan.php | 258 + src/Models/PlansItemsRequest.php | 95 + src/Models/PlansItemsRequest1.php | 95 + src/Models/PlansItemsResponse.php | 152 + src/Models/PlansMetadataRequest.php | 46 + src/Models/PlansMetadataResponse.php | 258 + src/Models/PlansRequest.php | 221 + src/Models/PlansRequest1.php | 191 + src/Models/PlansResponse.php | 56 + src/Models/PlansResponse1.php | 258 + src/Models/PriceBracket.php | 77 + src/Models/PricingScheme.php | 87 + src/Models/PricingScheme3.php | 86 + src/Models/PricingScheme4.php | 86 + src/Models/PrivateLabel.php | 139 + src/Models/Recipient.php | 233 + .../RecipientsAnticipationLimitsResponse.php | 57 + src/Models/RecipientsAnticipationsRequest.php | 69 + .../RecipientsAnticipationsResponse.php | 144 + .../RecipientsAnticipationsResponse1.php | 56 + ...sAutomaticAnticipationSettingsResponse.php | 233 + src/Models/RecipientsBalanceResponse.php | 88 + src/Models/RecipientsCodeResponse.php | 233 + .../RecipientsDefaultBankAccountRequest.php | 58 + .../RecipientsDefaultBankAccountResponse.php | 233 + src/Models/RecipientsMetadataRequest.php | 46 + src/Models/RecipientsMetadataResponse.php | 233 + src/Models/RecipientsRequest.php | 138 + src/Models/RecipientsRequest1.php | 96 + src/Models/RecipientsResponse.php | 56 + src/Models/RecipientsResponse1.php | 233 + .../RecipientsTransferSettingsResponse.php | 233 + src/Models/RecipientsTransfersRequest.php | 56 + src/Models/RecipientsTransfersResponse.php | 112 + src/Models/RecipientsTransfersResponse1.php | 56 + src/Models/Setup.php | 76 + src/Models/Setup1.php | 66 + src/Models/Shipping.php | 123 + src/Models/Shipping3.php | 134 + src/Models/Split.php | 56 + src/Models/Submerchant.php | 118 + .../SubscriptionsBillingDateRequest.php | 49 + src/Models/SubscriptionsCardRequest.php | 57 + src/Models/SubscriptionsCyclesPayRequest.php | 46 + src/Models/SubscriptionsCyclesPayResponse.php | 278 + src/Models/SubscriptionsCyclesResponse.php | 145 + src/Models/SubscriptionsCyclesResponse2.php | 54 + src/Models/SubscriptionsDiscountsRequest.php | 86 + src/Models/SubscriptionsDiscountsResponse.php | 139 + ...bscriptionsGatewayAffiliationIdRequest.php | 47 + src/Models/SubscriptionsIncrementsRequest.php | 86 + .../SubscriptionsIncrementsResponse.php | 139 + src/Models/SubscriptionsItemsRequest.php | 105 + src/Models/SubscriptionsItemsRequest1.php | 126 + src/Models/SubscriptionsItemsResponse3.php | 56 + .../SubscriptionsItemsUsagesResponse.php | 151 + .../SubscriptionsItemsUsagesResponse1.php | 56 + ...ubscriptionsItemsUsagesUsageIdResponse.php | 151 + src/Models/SubscriptionsMetadataRequest.php | 46 + .../SubscriptionsMinimumPriceRequest.php | 46 + .../SubscriptionsPartialInvoiceResponse.php | 278 + .../SubscriptionsPaymentMethodRequest.php | 78 + ...SubscriptionsPeriodsLatestEndAtRequest.php | 49 + src/Models/SubscriptionsRequest.php | 47 + src/Models/SubscriptionsRequest1.php | 360 ++ src/Models/SubscriptionsResponse3.php | 56 + src/Models/SubscriptionsStartAtRequest.php | 49 + src/Models/ThreedSecure.php | 88 + src/Models/ThreedSecure1.php | 103 + src/Models/Token.php | 75 + src/Models/TokensRequest.php | 56 + src/Models/TokensResponse.php | 90 + src/Models/UpdateCardRequest.php | 18 +- src/Models/UpdateChargeCardRequest.php | 12 +- .../UpdateChargePaymentMethodRequest.php | 42 +- src/Models/UpdateCustomerRequest.php | 24 +- src/Models/UpdatePlanItemRequest.php | 16 +- .../UpdateRecipientBankAccountRequest.php | 20 +- src/Models/UpdateSubscriptionCardRequest.php | 8 +- src/Models/UpdateSubscriptionItemRequest.php | 18 +- ...UpdateSubscriptionPaymentMethodRequest.php | 12 +- src/Models/Usages.php | 56 + src/Models/Voucher.php | 86 + src/MundiAPIClient.php | 64 +- tests/Controllers/ChargesControllerTest.php | 85 + tests/Controllers/CustomersControllerTest.php | 81 + tests/Controllers/InvoicesControllerTest.php | 87 + tests/Controllers/OrdersControllerTest.php | 83 + tests/Controllers/PlansControllerTest.php | 83 + .../Controllers/RecipientsControllerTest.php | 78 + .../SubscriptionsControllerTest.php | 88 + tests/Controllers/TransfersControllerTest.php | 74 + tests/HttpCallBackCatcher.php | 58 + tests/TestHelper.php | 359 ++ tests/bootstrap.php | 15 + 301 files changed, 31969 insertions(+), 4353 deletions(-) create mode 100644 phpunit.xml create mode 100644 src/Models/Address.php create mode 100644 src/Models/Address1.php create mode 100644 src/Models/ApplePay.php create mode 100644 src/Models/Authentication.php create mode 100644 src/Models/Authentication2.php create mode 100644 src/Models/BankAccount.php create mode 100644 src/Models/BankAccount1.php create mode 100644 src/Models/BankTransfer.php create mode 100644 src/Models/BankTransfer1.php create mode 100644 src/Models/BankTransfer2.php create mode 100644 src/Models/BillingAddress.php create mode 100644 src/Models/BillingAddress1.php create mode 100644 src/Models/Billingaddress3.php create mode 100644 src/Models/Boleto1.php create mode 100644 src/Models/Card.php create mode 100644 src/Models/Card1.php create mode 100644 src/Models/Card11.php create mode 100644 src/Models/Card9.php create mode 100644 src/Models/Charge.php create mode 100644 src/Models/ChargesCaptureRequest.php create mode 100644 src/Models/ChargesCaptureResponse.php create mode 100644 src/Models/ChargesCardRequest.php create mode 100644 src/Models/ChargesCardResponse.php create mode 100644 src/Models/ChargesConfirmPaymentResponse.php create mode 100644 src/Models/ChargesDueDateRequest.php create mode 100644 src/Models/ChargesDueDateResponse.php create mode 100644 src/Models/ChargesMetadataRequest.php create mode 100644 src/Models/ChargesMetadataResponse.php create mode 100644 src/Models/ChargesPaymentMethodRequest.php create mode 100644 src/Models/ChargesPaymentMethodResponse.php create mode 100644 src/Models/ChargesRequest.php create mode 100644 src/Models/ChargesRequest1.php create mode 100644 src/Models/ChargesResponse.php create mode 100644 src/Models/ChargesResponse2.php create mode 100644 src/Models/ChargesRetryResponse.php create mode 100644 src/Models/ChargesTransactionsResponse.php create mode 100644 src/Models/Checkout.php create mode 100644 src/Models/Contactless.php create mode 100644 src/Models/CreditCard1.php create mode 100644 src/Models/CreditCard2.php create mode 100644 src/Models/CurrentCycle.php create mode 100644 src/Models/Customer.php create mode 100644 src/Models/Customer8.php create mode 100644 src/Models/CustomersAccessTokensRequest.php create mode 100644 src/Models/CustomersAccessTokensResponse.php create mode 100644 src/Models/CustomersAccessTokensResponse1.php create mode 100644 src/Models/CustomersAddressesRequest.php create mode 100644 src/Models/CustomersAddressesRequest1.php create mode 100644 src/Models/CustomersAddressesResponse.php create mode 100644 src/Models/CustomersAddressesResponse1.php create mode 100644 src/Models/CustomersCardsRenewResponse.php create mode 100644 src/Models/CustomersCardsRequest.php create mode 100644 src/Models/CustomersCardsRequest1.php create mode 100644 src/Models/CustomersCardsResponse.php create mode 100644 src/Models/CustomersCardsResponse1.php create mode 100644 src/Models/CustomersMetadataRequest.php create mode 100644 src/Models/CustomersMetadataResponse.php create mode 100644 src/Models/CustomersRequest.php create mode 100644 src/Models/CustomersRequest1.php create mode 100644 src/Models/CustomersResponse.php create mode 100644 src/Models/CustomersResponse3.php create mode 100644 src/Models/Cycle.php create mode 100644 src/Models/DebitCard1.php create mode 100644 src/Models/DebitCard2.php create mode 100644 src/Models/DefaultBankAccount.php create mode 100644 src/Models/DefaultBankAccount1.php create mode 100644 src/Models/Device.php create mode 100644 src/Models/Device1.php create mode 100644 src/Models/Fine.php create mode 100644 src/Models/GatewayResponse.php create mode 100644 src/Models/GooglePay.php create mode 100644 src/Models/Header.php create mode 100644 src/Models/Header1.php create mode 100644 src/Models/Interest.php create mode 100644 src/Models/Invoice.php create mode 100644 src/Models/InvoicesMetadataRequest.php create mode 100644 src/Models/InvoicesMetadataResponse.php create mode 100644 src/Models/InvoicesResponse.php create mode 100644 src/Models/InvoicesResponse2.php create mode 100644 src/Models/InvoicesStatusResponse.php create mode 100644 src/Models/Location.php create mode 100644 src/Models/Max.php create mode 100644 src/Models/Min.php create mode 100644 src/Models/Options1.php create mode 100644 src/Models/Options2.php create mode 100644 src/Models/Order.php create mode 100644 src/Models/OrdersClosedResponse.php create mode 100644 src/Models/OrdersItemsRequest.php create mode 100644 src/Models/OrdersItemsRequest1.php create mode 100644 src/Models/OrdersItemsResponse.php create mode 100644 src/Models/OrdersItemsResponse1.php create mode 100644 src/Models/OrdersMetadataRequest.php create mode 100644 src/Models/OrdersMetadataResponse.php create mode 100644 src/Models/OrdersRequest.php create mode 100644 src/Models/OrdersResponse.php create mode 100644 src/Models/OrdersResponse1.php create mode 100644 src/Models/Paging.php create mode 100644 src/Models/Payment.php create mode 100644 src/Models/Period.php create mode 100644 src/Models/Pix.php create mode 100644 src/Models/Plan.php create mode 100644 src/Models/PlansItemsRequest.php create mode 100644 src/Models/PlansItemsRequest1.php create mode 100644 src/Models/PlansItemsResponse.php create mode 100644 src/Models/PlansMetadataRequest.php create mode 100644 src/Models/PlansMetadataResponse.php create mode 100644 src/Models/PlansRequest.php create mode 100644 src/Models/PlansRequest1.php create mode 100644 src/Models/PlansResponse.php create mode 100644 src/Models/PlansResponse1.php create mode 100644 src/Models/PriceBracket.php create mode 100644 src/Models/PricingScheme.php create mode 100644 src/Models/PricingScheme3.php create mode 100644 src/Models/PricingScheme4.php create mode 100644 src/Models/PrivateLabel.php create mode 100644 src/Models/Recipient.php create mode 100644 src/Models/RecipientsAnticipationLimitsResponse.php create mode 100644 src/Models/RecipientsAnticipationsRequest.php create mode 100644 src/Models/RecipientsAnticipationsResponse.php create mode 100644 src/Models/RecipientsAnticipationsResponse1.php create mode 100644 src/Models/RecipientsAutomaticAnticipationSettingsResponse.php create mode 100644 src/Models/RecipientsBalanceResponse.php create mode 100644 src/Models/RecipientsCodeResponse.php create mode 100644 src/Models/RecipientsDefaultBankAccountRequest.php create mode 100644 src/Models/RecipientsDefaultBankAccountResponse.php create mode 100644 src/Models/RecipientsMetadataRequest.php create mode 100644 src/Models/RecipientsMetadataResponse.php create mode 100644 src/Models/RecipientsRequest.php create mode 100644 src/Models/RecipientsRequest1.php create mode 100644 src/Models/RecipientsResponse.php create mode 100644 src/Models/RecipientsResponse1.php create mode 100644 src/Models/RecipientsTransferSettingsResponse.php create mode 100644 src/Models/RecipientsTransfersRequest.php create mode 100644 src/Models/RecipientsTransfersResponse.php create mode 100644 src/Models/RecipientsTransfersResponse1.php create mode 100644 src/Models/Setup.php create mode 100644 src/Models/Setup1.php create mode 100644 src/Models/Shipping.php create mode 100644 src/Models/Shipping3.php create mode 100644 src/Models/Split.php create mode 100644 src/Models/Submerchant.php create mode 100644 src/Models/SubscriptionsBillingDateRequest.php create mode 100644 src/Models/SubscriptionsCardRequest.php create mode 100644 src/Models/SubscriptionsCyclesPayRequest.php create mode 100644 src/Models/SubscriptionsCyclesPayResponse.php create mode 100644 src/Models/SubscriptionsCyclesResponse.php create mode 100644 src/Models/SubscriptionsCyclesResponse2.php create mode 100644 src/Models/SubscriptionsDiscountsRequest.php create mode 100644 src/Models/SubscriptionsDiscountsResponse.php create mode 100644 src/Models/SubscriptionsGatewayAffiliationIdRequest.php create mode 100644 src/Models/SubscriptionsIncrementsRequest.php create mode 100644 src/Models/SubscriptionsIncrementsResponse.php create mode 100644 src/Models/SubscriptionsItemsRequest.php create mode 100644 src/Models/SubscriptionsItemsRequest1.php create mode 100644 src/Models/SubscriptionsItemsResponse3.php create mode 100644 src/Models/SubscriptionsItemsUsagesResponse.php create mode 100644 src/Models/SubscriptionsItemsUsagesResponse1.php create mode 100644 src/Models/SubscriptionsItemsUsagesUsageIdResponse.php create mode 100644 src/Models/SubscriptionsMetadataRequest.php create mode 100644 src/Models/SubscriptionsMinimumPriceRequest.php create mode 100644 src/Models/SubscriptionsPartialInvoiceResponse.php create mode 100644 src/Models/SubscriptionsPaymentMethodRequest.php create mode 100644 src/Models/SubscriptionsPeriodsLatestEndAtRequest.php create mode 100644 src/Models/SubscriptionsRequest.php create mode 100644 src/Models/SubscriptionsRequest1.php create mode 100644 src/Models/SubscriptionsResponse3.php create mode 100644 src/Models/SubscriptionsStartAtRequest.php create mode 100644 src/Models/ThreedSecure.php create mode 100644 src/Models/ThreedSecure1.php create mode 100644 src/Models/Token.php create mode 100644 src/Models/TokensRequest.php create mode 100644 src/Models/TokensResponse.php create mode 100644 src/Models/Usages.php create mode 100644 src/Models/Voucher.php create mode 100644 tests/Controllers/ChargesControllerTest.php create mode 100644 tests/Controllers/CustomersControllerTest.php create mode 100644 tests/Controllers/InvoicesControllerTest.php create mode 100644 tests/Controllers/OrdersControllerTest.php create mode 100644 tests/Controllers/PlansControllerTest.php create mode 100644 tests/Controllers/RecipientsControllerTest.php create mode 100644 tests/Controllers/SubscriptionsControllerTest.php create mode 100644 tests/Controllers/TransfersControllerTest.php create mode 100644 tests/HttpCallBackCatcher.php create mode 100644 tests/TestHelper.php create mode 100644 tests/bootstrap.php diff --git a/README.md b/README.md index 4233b7a..013be40 100644 --- a/README.md +++ b/README.md @@ -132,36 +132,36 @@ $client = new MundiAPILib\MundiAPIClient($basicAuthUserName, $basicAuthPassword) ## List of Controllers +* [SubscriptionsController](#subscriptions_controller) +* [OrdersController](#orders_controller) +* [PlansController](#plans_controller) +* [InvoicesController](#invoices_controller) * [CustomersController](#customers_controller) * [ChargesController](#charges_controller) * [RecipientsController](#recipients_controller) -* [SubscriptionsController](#subscriptions_controller) -* [InvoicesController](#invoices_controller) -* [OrdersController](#orders_controller) * [TokensController](#tokens_controller) -* [PlansController](#plans_controller) * [TransactionsController](#transactions_controller) * [TransfersController](#transfers_controller) -## ![Class: ](https://apidocs.io/img/class.png ".CustomersController") CustomersController +## ![Class: ](https://apidocs.io/img/class.png ".SubscriptionsController") SubscriptionsController ### Get singleton instance -The singleton instance of the ``` CustomersController ``` class can be accessed from the API Client. +The singleton instance of the ``` SubscriptionsController ``` class can be accessed from the API Client. ```php -$customers = $client->getCustomers(); +$subscriptions = $client->getSubscriptions(); ``` -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createAccessToken") createAccessToken +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createDiscount") createDiscount -> Creates a access token for a customer +> Creates a discount ```php -function createAccessToken( - $customerId, - $request, +function createDiscount( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -169,8 +169,8 @@ function createAccessToken( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| request | ``` Required ``` | Request for creating a access token | +| subscriptionId | ``` Required ``` | Subscription id | +| body | ``` Required ``` | Request for creating a discount | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -178,275 +178,394 @@ function createAccessToken( #### Example Usage ```php -$customerId = 'customer_id'; -$request = new CreateAccessTokenRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsDiscountsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->createAccessToken($customerId, $request, $idempotencyKey); +$result = $subscriptions->createDiscount($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCustomer") updateCustomer +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionItem") getSubscriptionItem + +> Get Subscription Item ```php -function updateCustomer( - $customerId, - $request, - $idempotencyKey = null) +function getSubscriptionItem( + $subscriptionId, + $itemId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| request | ``` Required ``` | Request for updating a customer | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | Subscription Id | +| itemId | ``` Required ``` | Item id | #### Example Usage ```php -$customerId = 'customer_id'; -$request = new UpdateCustomerRequest(); -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$itemId = 'item_id'; -$result = $customers->updateCustomer($customerId, $request, $idempotencyKey); +$result = $subscriptions->getSubscriptionItem($subscriptionId, $itemId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAccessTokens") deleteAccessTokens +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Delete a Customer's access tokens + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionItem") updateSubscriptionItem + +> Updates a subscription item ```php -function deleteAccessTokens($customerId) +function updateSubscriptionItem( + $subscriptionId, + $itemId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | +| subscriptionId | ``` Required ``` | Subscription Id | +| itemId | ``` Required ``` | Item id | +| body | ``` Required ``` | Request for updating a subscription item | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; +$subscriptionId = 'subscription_id'; +$itemId = 'item_id'; +$body = new SubscriptionsItemsRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $customers->deleteAccessTokens($customerId); +$result = $subscriptions->updateSubscriptionItem($subscriptionId, $itemId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCustomer") getCustomer +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteUsage") deleteUsage + +> Deletes a usage ```php -function getCustomer($customerId) +function deleteUsage( + $subscriptionId, + $itemId, + $usageId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | +| subscriptionId | ``` Required ``` | The subscription id | +| itemId | ``` Required ``` | The subscription item id | +| usageId | ``` Required ``` | The usage id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; +$subscriptionId = 'subscription_id'; +$itemId = 'item_id'; +$usageId = 'usage_id'; +$idempotencyKey = 'idempotency-key'; -$result = $customers->getCustomer($customerId); +$result = $subscriptions->deleteUsage($subscriptionId, $itemId, $usageId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAddresses") getAddresses +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets all adressess from a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.cancelSubscription") cancelSubscription + +> Cancels a subscription ```php -function getAddresses( - $customerId, - $page = null, - $size = null) +function cancelSubscription( + $subscriptionId, + $idempotencyKey = null, + $body = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | +| subscriptionId | ``` Required ``` | Subscription id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| body | ``` Optional ``` | Request for cancelling a subscription | #### Example Usage ```php -$customerId = 'customer_id'; -$page = 32; -$size = 32; +$subscriptionId = 'subscription_id'; +$idempotencyKey = 'idempotency-key'; +$body = new SubscriptionsRequest(); -$result = $customers->getAddresses($customerId, $page, $size); +$result = $subscriptions->cancelSubscription($subscriptionId, $idempotencyKey, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAccessToken") getAccessToken +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get a Customer's access token + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscription") getSubscription + +> Gets a subscription ```php -function getAccessToken( - $customerId, - $tokenId) +function getSubscription($subscriptionId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| tokenId | ``` Required ``` | Token Id | +| subscriptionId | ``` Required ``` | Subscription id | #### Example Usage ```php -$customerId = 'customer_id'; -$tokenId = 'token_id'; +$subscriptionId = 'subscription_id'; -$result = $customers->getAccessToken($customerId, $tokenId); +$result = $subscriptions->getSubscription($subscriptionId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAddress") getAddress +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get a customer's address + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteIncrement") deleteIncrement + +> Deletes a increment ```php -function getAddress( - $customerId, - $addressId) +function deleteIncrement( + $subscriptionId, + $incrementId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| addressId | ``` Required ``` | Address Id | +| subscriptionId | ``` Required ``` | Subscription id | +| incrementId | ``` Required ``` | Increment id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; -$addressId = 'address_id'; +$subscriptionId = 'subscription_id'; +$incrementId = 'increment_id'; +$idempotencyKey = 'idempotency-key'; -$result = $customers->getAddress($customerId, $addressId); +$result = $subscriptions->deleteIncrement($subscriptionId, $incrementId, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createCard") createCard -> Creates a new card for a customer + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getIncrementById") getIncrementById + +> GetIncrementById ```php -function createCard( - $customerId, - $request, - $idempotencyKey = null) +function getIncrementById( + $subscriptionId, + $incrementId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| request | ``` Required ``` | Request for creating a card | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription Id | +| incrementId | ``` Required ``` | The increment Id | #### Example Usage ```php -$customerId = 'customer_id'; -$request = new CreateCardRequest(); -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$incrementId = 'increment_id'; -$result = $customers->createCard($customerId, $request, $idempotencyKey); +$result = $subscriptions->getIncrementById($subscriptionId, $incrementId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.renewCard") renewCard +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Renew a card + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionCycleById") getSubscriptionCycleById + +> GetSubscriptionCycleById ```php -function renewCard( - $customerId, - $cardId, - $idempotencyKey = null) +function getSubscriptionCycleById( + $subscriptionId, + $cycleId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| cardId | ``` Required ``` | Card Id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription id | +| cycleId | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; -$cardId = 'card_id'; -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$cycleId = 'cycleId'; -$result = $customers->renewCard($customerId, $cardId, $idempotencyKey); +$result = $subscriptions->getSubscriptionCycleById($subscriptionId, $cycleId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createCustomer") createCustomer +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionStartAt") updateSubscriptionStartAt + +> Updates the start at date from a subscription ```php -function createCustomer( - $request, +function updateSubscriptionStartAt( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -454,7 +573,8 @@ function createCustomer( | Parameter | Tags | Description | |-----------|------|-------------| -| request | ``` Required ``` | Request for creating a customer | +| subscriptionId | ``` Required ``` | The subscription id | +| body | ``` Required ``` | Request for updating the subscription start date | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -462,24 +582,36 @@ function createCustomer( #### Example Usage ```php -$request = new CreateCustomerRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsStartAtRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->createCustomer($request, $idempotencyKey); +$result = $subscriptions->updateSubscriptionStartAt($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateAddress") updateAddress +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates an address + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionPaymentMethod") updateSubscriptionPaymentMethod + +> Updates the payment method from a subscription ```php -function updateAddress( - $customerId, - $addressId, - $request, +function updateSubscriptionPaymentMethod( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -487,9 +619,8 @@ function updateAddress( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| addressId | ``` Required ``` | Address Id | -| request | ``` Required ``` | Request for updating an address | +| subscriptionId | ``` Required ``` | Subscription id | +| body | ``` Required ``` | Request for updating the paymentmethod from a subscription | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -497,93 +628,541 @@ function updateAddress( #### Example Usage ```php -$customerId = 'customer_id'; -$addressId = 'address_id'; -$request = new UpdateAddressRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsPaymentMethodRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->updateAddress($customerId, $addressId, $request, $idempotencyKey); +$result = $subscriptions->updateSubscriptionPaymentMethod($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAccessTokens") getAccessTokens +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get all access tokens from a customer -```php -function getAccessTokens( - $customerId, - $page = null, - $size = null) -``` +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateCurrentCycleStatus") updateCurrentCycleStatus -#### Parameters +> UpdateCurrentCycleStatus -| Parameter | Tags | Description | -|-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | + +```php +function updateCurrentCycleStatus( + $subscriptionId, + $body, + $idempotencyKey = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | Subscription Id | +| body | ``` Required ``` | Request for updating the end date of the subscription current status | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$body = new UpdateCurrentCycleStatusRequest(); +$idempotencyKey = 'idempotency-key'; + +$subscriptions->updateCurrentCycleStatus($subscriptionId, $body, $idempotencyKey); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createSubscription") createSubscription + +> Creates a new subscription + + +```php +function createSubscription( + $body, + $idempotencyKey = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| body | ``` Required ``` | Request for creating a subscription | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | + + + +#### Example Usage + +```php +$body = new SubscriptionsRequest1(); +$idempotencyKey = 'idempotency-key'; + +$result = $subscriptions->createSubscription($body, $idempotencyKey); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptions") getSubscriptions + +> Gets all subscriptions + + +```php +function getSubscriptions( + $page = null, + $size = null, + $code = null, + $billingType = null, + $customerId = null, + $planId = null, + $cardId = null, + $status = null, + $nextBillingSince = null, + $nextBillingUntil = null, + $createdSince = null, + $createdUntil = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| | page | ``` Optional ``` | Page number | | size | ``` Optional ``` | Page size | +| code | ``` Optional ``` | Filter for subscription's code | +| billingType | ``` Optional ``` | Filter for subscription's billing type | +| customerId | ``` Optional ``` | Filter for subscription's customer id | +| planId | ``` Optional ``` | Filter for subscription's plan id | +| cardId | ``` Optional ``` | Filter for subscription's card id | +| status | ``` Optional ``` | Filter for subscription's status | +| nextBillingSince | ``` Optional ``` | Filter for subscription's next billing date start range | +| nextBillingUntil | ``` Optional ``` | Filter for subscription's next billing date end range | +| createdSince | ``` Optional ``` | Filter for subscription's creation date start range | +| createdUntil | ``` Optional ``` | Filter for subscriptions creation date end range | + + + +#### Example Usage + +```php +$page = 217; +$size = 217; +$code = 'code'; +$billingType = 'billing_type'; +$customerId = 'customer_id'; +$planId = 'plan_id'; +$cardId = 'card_id'; +$status = 'status'; +$nextBillingSince = date("D M d, Y G:i"); +$nextBillingUntil = date("D M d, Y G:i"); +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); + +$result = $subscriptions->getSubscriptions($page, $size, $code, $billingType, $customerId, $planId, $cardId, $status, $nextBillingSince, $nextBillingUntil, $createdSince, $createdUntil); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsagesDetails") getUsagesDetails + +> GetUsagesDetails + + +```php +function getUsagesDetails( + $subscriptionId, + $cycleId = null, + $size = null, + $page = null, + $itemId = null, + $group = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | Subscription Identifier | +| cycleId | ``` Optional ``` | Cycle id | +| size | ``` Optional ``` | Page size | +| page | ``` Optional ``` | Page number | +| itemId | ``` Optional ``` | Identificador do item | +| group | ``` Optional ``` | identificador da loja (account) de cada item | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$cycleId = 'cycle_id'; +$size = 175; +$page = 175; +$itemId = 'item_id'; +$group = 'group'; + +$result = $subscriptions->getUsagesDetails($subscriptionId, $cycleId, $size, $page, $itemId, $group); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.renewSubscription") renewSubscription + +> RenewSubscription + + +```php +function renewSubscription( + $subscriptionId, + $idempotencyKey = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | TODO: Add a parameter description | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$idempotencyKey = 'idempotency-key'; + +$result = $subscriptions->renewSubscription($subscriptionId, $idempotencyKey); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionCycles") getSubscriptionCycles + +> GetSubscriptionCycles + + +```php +function getSubscriptionCycles( + $subscriptionId, + $page, + $size) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | Subscription Id | +| page | ``` Required ``` | Page number | +| size | ``` Required ``` | Page size | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$page = 'page'; +$size = 'size'; + +$result = $subscriptions->getSubscriptionCycles($subscriptionId, $page, $size); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createAnUsage") createAnUsage + +> Create Usage + + +```php +function createAnUsage( + $subscriptionId, + $itemId, + $idempotencyKey = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | Subscription id | +| itemId | ``` Required ``` | Item id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$itemId = 'item_id'; +$idempotencyKey = 'idempotency-key'; + +$result = $subscriptions->createAnUsage($subscriptionId, $itemId, $idempotencyKey); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsages") getUsages + +> Lists all usages from a subscription item + + +```php +function getUsages( + $subscriptionId, + $itemId, + $page = null, + $size = null, + $code = null, + $group = null, + $usedSince = null, + $usedUntil = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | The subscription id | +| itemId | ``` Required ``` | The subscription item id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| code | ``` Optional ``` | Identification code in the client system | +| group | ``` Optional ``` | Identification group in the client system | +| usedSince | ``` Optional ``` | TODO: Add a parameter description | +| usedUntil | ``` Optional ``` | TODO: Add a parameter description | + + + +#### Example Usage + +```php +$subscriptionId = 'subscription_id'; +$itemId = 'item_id'; +$page = 175; +$size = 175; +$code = 'code'; +$group = 'group'; +$usedSince = date("D M d, Y G:i"); +$usedUntil = date("D M d, Y G:i"); + +$result = $subscriptions->getUsages($subscriptionId, $itemId, $page, $size, $code, $group, $usedSince, $usedUntil); + +``` + +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteDiscount") deleteDiscount + +> Deletes a discount + + +```php +function deleteDiscount( + $subscriptionId, + $discountId, + $idempotencyKey = null) +``` + +#### Parameters + +| Parameter | Tags | Description | +|-----------|------|-------------| +| subscriptionId | ``` Required ``` | Subscription id | +| discountId | ``` Required ``` | Discount Id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; -$page = 32; -$size = 32; +$subscriptionId = 'subscription_id'; +$discountId = 'discount_id'; +$idempotencyKey = 'idempotency-key'; -$result = $customers->getAccessTokens($customerId, $page, $size); +$result = $subscriptions->deleteDiscount($subscriptionId, $discountId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCustomerMetadata") updateCustomerMetadata +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the metadata a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getIncrements") getIncrements + +> GetIncrements ```php -function updateCustomerMetadata( - $customerId, - $request, - $idempotencyKey = null) +function getIncrements( + $subscriptionId, + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | The customer id | -| request | ``` Required ``` | Request for updating the customer metadata | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$customerId = 'customer_id'; -$request = new UpdateMetadataRequest(); -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$page = 175; +$size = 175; -$result = $customers->updateCustomerMetadata($customerId, $request, $idempotencyKey); +$result = $subscriptions->getIncrements($subscriptionId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAddress") deleteAddress +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Delete a Customer's address + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createSubscriptionItem") createSubscriptionItem + +> Creates a new Subscription item ```php -function deleteAddress( - $customerId, - $addressId, +function createSubscriptionItem( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -591,8 +1170,8 @@ function deleteAddress( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| addressId | ``` Required ``` | Address Id | +| subscriptionId | ``` Required ``` | Subscription id | +| body | ``` Required ``` | Request for creating a subscription item | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -600,61 +1179,100 @@ function deleteAddress( #### Example Usage ```php -$customerId = 'customer_id'; -$addressId = 'address_id'; +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsItemsRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $customers->deleteAddress($customerId, $addressId, $idempotencyKey); +$result = $subscriptions->createSubscriptionItem($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCard") updateCard +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates a card + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionItems") getSubscriptionItems + +> Get Subscription Items ```php -function updateCard( - $customerId, - $cardId, - $request, - $idempotencyKey = null) +function getSubscriptionItems( + $subscriptionId, + $page = null, + $size = null, + $name = null, + $code = null, + $status = null, + $description = null, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| cardId | ``` Required ``` | Card id | -| request | ``` Required ``` | Request for updating a card | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| name | ``` Optional ``` | The item name | +| code | ``` Optional ``` | Identification code in the client system | +| status | ``` Optional ``` | The item statis | +| description | ``` Optional ``` | The item description | +| createdSince | ``` Optional ``` | Filter for item's creation date start range | +| createdUntil | ``` Optional ``` | Filter for item's creation date end range | #### Example Usage ```php -$customerId = 'customer_id'; -$cardId = 'card_id'; -$request = new UpdateCardRequest(); -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$page = 175; +$size = 175; +$name = 'name'; +$code = 'code'; +$status = 'status'; +$description = 'description'; +$createdSince = 'created_since'; +$createdUntil = 'created_until'; -$result = $customers->updateCard($customerId, $cardId, $request, $idempotencyKey); +$result = $subscriptions->getSubscriptionItems($subscriptionId, $page, $size, $name, $code, $status, $description, $createdSince, $createdUntil); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAccessToken") deleteAccessToken +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Delete a customer's access token + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionBillingDate") updateSubscriptionBillingDate + +> Updates the billing date from a subscription ```php -function deleteAccessToken( - $customerId, - $tokenId, +function updateSubscriptionBillingDate( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -662,8 +1280,8 @@ function deleteAccessToken( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| tokenId | ``` Required ``` | Token Id | +| subscriptionId | ``` Required ``` | The subscription id | +| body | ``` Required ``` | Request for updating the subscription billing date | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -671,24 +1289,36 @@ function deleteAccessToken( #### Example Usage ```php -$customerId = 'customer_id'; -$tokenId = 'token_id'; +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsBillingDateRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->deleteAccessToken($customerId, $tokenId, $idempotencyKey); +$result = $subscriptions->updateSubscriptionBillingDate($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createAddress") createAddress +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new address for a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateLatestPeriodEndAt") updateLatestPeriodEndAt + +> UpdateLatestPeriodEndAt ```php -function createAddress( - $customerId, - $request, +function updateLatestPeriodEndAt( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -696,8 +1326,8 @@ function createAddress( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| request | ``` Required ``` | Request for creating an address | +| subscriptionId | ``` Required ``` | TODO: Add a parameter description | +| body | ``` Required ``` | Request for updating the end date of the current signature cycle | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -705,89 +1335,128 @@ function createAddress( #### Example Usage ```php -$customerId = 'customer_id'; -$request = new CreateAddressRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsPeriodsLatestEndAtRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->createAddress($customerId, $request, $idempotencyKey); +$result = $subscriptions->updateLatestPeriodEndAt($subscriptionId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCard") getCard -> Get a customer's card + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionAffiliationId") updateSubscriptionAffiliationId + +> UpdateSubscriptionAffiliationId ```php -function getCard( - $customerId, - $cardId) +function updateSubscriptionAffiliationId( + $subscriptionId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer id | -| cardId | ``` Required ``` | Card id | +| subscriptionId | ``` Required ``` | TODO: Add a parameter description | +| body | ``` Required ``` | Request for updating a subscription affiliation id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; -$cardId = 'card_id'; +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsGatewayAffiliationIdRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $customers->getCard($customerId, $cardId); +$result = $subscriptions->updateSubscriptionAffiliationId($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCards") getCards +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get all cards from a customer + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteSubscriptionItem") deleteSubscriptionItem + +> Deletes a subscription item ```php -function getCards( - $customerId, - $page = null, - $size = null) +function deleteSubscriptionItem( + $subscriptionId, + $subscriptionItemId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | +| subscriptionId | ``` Required ``` | Subscription id | +| subscriptionItemId | ``` Required ``` | Subscription item id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$customerId = 'customer_id'; -$page = 32; -$size = 32; +$subscriptionId = 'subscription_id'; +$subscriptionItemId = 'subscription_item_id'; +$idempotencyKey = 'idempotency-key'; -$result = $customers->getCards($customerId, $page, $size); +$result = $subscriptions->deleteSubscriptionItem($subscriptionId, $subscriptionItemId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteCard") deleteCard +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Delete a customer's card + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionCard") updateSubscriptionCard + +> Updates the credit card from a subscription ```php -function deleteCard( - $customerId, - $cardId, +function updateSubscriptionCard( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -795,8 +1464,8 @@ function deleteCard( | Parameter | Tags | Description | |-----------|------|-------------| -| customerId | ``` Required ``` | Customer Id | -| cardId | ``` Required ``` | Card Id | +| subscriptionId | ``` Required ``` | Subscription id | +| body | ``` Required ``` | Request for updating a card | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -804,140 +1473,174 @@ function deleteCard( #### Example Usage ```php -$customerId = 'customer_id'; -$cardId = 'card_id'; +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsCardRequest(); $idempotencyKey = 'idempotency-key'; -$result = $customers->deleteCard($customerId, $cardId, $idempotencyKey); +$result = $subscriptions->updateSubscriptionCard($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCustomers") getCustomers +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get all Customers + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionMetadata") updateSubscriptionMetadata + +> Updates the metadata from a subscription ```php -function getCustomers( - $name = null, - $document = null, - $page = 1, - $size = 10, - $email = null, - $code = null) +function updateSubscriptionMetadata( + $subscriptionId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| name | ``` Optional ``` | Name of the Customer | -| document | ``` Optional ``` | Document of the Customer | -| page | ``` Optional ``` ``` DefaultValue ``` | Current page the the search | -| size | ``` Optional ``` ``` DefaultValue ``` | Quantity pages of the search | -| email | ``` Optional ``` | Customer's email | -| code | ``` Optional ``` | Customer's code | +| subscriptionId | ``` Required ``` | The subscription id | +| body | ``` Required ``` | Request for updating the subscrption metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$name = 'name'; -$document = 'document'; -$page = 1; -$size = 10; -$email = 'email'; -$code = 'Code'; +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $customers->getCustomers($name, $document, $page, $size, $email, $code); +$result = $subscriptions->updateSubscriptionMetadata($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".ChargesController") ChargesController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` ChargesController ``` class can be accessed from the API Client. -```php -$charges = $client->getCharges(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getCharge") getCharge +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionDueDays") updateSubscriptionDueDays -> Get a charge from its id +> Updates the boleto due days from a subscription ```php -function getCharge($chargeId) +function updateSubscriptionDueDays( + $subscriptionId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | +| subscriptionId | ``` Required ``` | Subscription Id | +| body | ``` Required ``` | TODO: Add a parameter description | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$chargeId = 'charge_id'; +$subscriptionId = 'subscription_id'; +$body = new UpdateSubscriptionDueDaysRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $charges->getCharge($chargeId); +$result = $subscriptions->updateSubscriptionDueDays($subscriptionId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.confirmPayment") confirmPayment -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getDiscounts") getDiscounts + +> GetDiscounts ```php -function confirmPayment( - $chargeId, - $request = null, - $idempotencyKey = null) +function getDiscounts( + $subscriptionId, + $page, + $size) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | TODO: Add a parameter description | -| request | ``` Optional ``` | Request for confirm payment | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription id | +| page | ``` Required ``` | Page number | +| size | ``` Required ``` | Page size | #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new CreateConfirmPaymentRequest(); -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$page = 175; +$size = 175; -$result = $charges->confirmPayment($chargeId, $request, $idempotencyKey); +$result = $subscriptions->getDiscounts($subscriptionId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeCard") updateChargeCard +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the card from a charge + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createIncrement") createIncrement + +> Creates a increment ```php -function updateChargeCard( - $chargeId, - $request, +function createIncrement( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -945,8 +1648,8 @@ function updateChargeCard( | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | -| request | ``` Required ``` | Request for updating a charge's card | +| subscriptionId | ``` Required ``` | Subscription id | +| body | ``` Required ``` | Request for creating a increment | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -954,76 +1657,79 @@ function updateChargeCard( #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new UpdateChargeCardRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsIncrementsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $charges->updateChargeCard($chargeId, $request, $idempotencyKey); +$result = $subscriptions->createIncrement($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getCharges") getCharges +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Lists all charges + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getDiscountById") getDiscountById + +> GetDiscountById ```php -function getCharges( - $page = null, - $size = null, - $code = null, - $status = null, - $paymentMethod = null, - $customerId = null, - $orderId = null, - $createdSince = null, - $createdUntil = null) +function getDiscountById( + $subscriptionId, + $discountId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| code | ``` Optional ``` | Filter for charge's code | -| status | ``` Optional ``` | Filter for charge's status | -| paymentMethod | ``` Optional ``` | Filter for charge's payment method | -| customerId | ``` Optional ``` | Filter for charge's customer id | -| orderId | ``` Optional ``` | Filter for charge's order id | -| createdSince | ``` Optional ``` | Filter for the beginning of the range for charge's creation | -| createdUntil | ``` Optional ``` | Filter for the end of the range for charge's creation | +| subscriptionId | ``` Required ``` | The subscription id | +| discountId | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$page = 32; -$size = 32; -$code = 'code'; -$status = 'status'; -$paymentMethod = 'payment_method'; -$customerId = 'customer_id'; -$orderId = 'order_id'; -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); +$subscriptionId = 'subscription_id'; +$discountId = 'discountId'; -$result = $charges->getCharges($page, $size, $code, $status, $paymentMethod, $customerId, $orderId, $createdSince, $createdUntil); +$result = $subscriptions->getDiscountById($subscriptionId, $discountId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.cancelCharge") cancelCharge +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Cancel a charge + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionMiniumPrice") updateSubscriptionMiniumPrice + +> Atualização do valor mínimo da assinatura ```php -function cancelCharge( - $chargeId, - $request = null, +function updateSubscriptionMiniumPrice( + $subscriptionId, + $body, $idempotencyKey = null) ``` @@ -1031,8 +1737,8 @@ function cancelCharge( | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | -| request | ``` Optional ``` | Request for cancelling a charge | +| subscriptionId | ``` Required ``` | Subscription Id | +| body | ``` Required ``` | Request da requisição com o valor mínimo que será configurado | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1040,123 +1746,134 @@ function cancelCharge( #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new CreateCancelChargeRequest(); +$subscriptionId = 'subscription_id'; +$body = new SubscriptionsMinimumPriceRequest(); $idempotencyKey = 'idempotency-key'; -$result = $charges->cancelCharge($chargeId, $request, $idempotencyKey); +$result = $subscriptions->updateSubscriptionMiniumPrice($subscriptionId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.retryCharge") retryCharge +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Retries a charge + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsageReport") getUsageReport + +> GetUsageReport ```php -function retryCharge( - $chargeId, - $idempotencyKey = null) +function getUsageReport( + $subscriptionId, + $periodId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| subscriptionId | ``` Required ``` | The subscription Id | +| periodId | ``` Required ``` | The period Id | #### Example Usage ```php -$chargeId = 'charge_id'; -$idempotencyKey = 'idempotency-key'; +$subscriptionId = 'subscription_id'; +$periodId = 'period_id'; -$result = $charges->retryCharge($chargeId, $idempotencyKey); +$result = $subscriptions->getUsageReport($subscriptionId, $periodId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargePaymentMethod") updateChargePaymentMethod +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates a charge's payment method + + +### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSplitSubscription") updateSplitSubscription + +> UpdateSplitSubscription ```php -function updateChargePaymentMethod( - $chargeId, - $request, - $idempotencyKey = null) +function updateSplitSubscription( + $id, + $body) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | -| request | ``` Required ``` | Request for updating the payment method from a charge | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| id | ``` Required ``` | Subscription's id | +| body | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new UpdateChargePaymentMethodRequest(); -$idempotencyKey = 'idempotency-key'; +$id = 'id'; +$body = new UpdateSubscriptionSplitRequest(); -$result = $charges->updateChargePaymentMethod($chargeId, $request, $idempotencyKey); +$result = $subscriptions->updateSplitSubscription($id, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeMetadata") updateChargeMetadata - -> Updates the metadata from a charge - +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -function updateChargeMetadata( - $chargeId, - $request, - $idempotencyKey = null) -``` -#### Parameters -| Parameter | Tags | Description | -|-----------|------|-------------| -| chargeId | ``` Required ``` | The charge id | -| request | ``` Required ``` | Request for updating the charge metadata | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +[Back to List of Controllers](#list_of_controllers) +## ![Class: ](https://apidocs.io/img/class.png ".OrdersController") OrdersController +### Get singleton instance -#### Example Usage +The singleton instance of the ``` OrdersController ``` class can be accessed from the API Client. ```php -$chargeId = 'charge_id'; -$request = new UpdateMetadataRequest(); -$idempotencyKey = 'idempotency-key'; - -$result = $charges->updateChargeMetadata($chargeId, $request, $idempotencyKey); - +$orders = $client->getOrders(); ``` +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderStatus") updateOrderStatus -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.captureCharge") captureCharge - -> Captures a charge +> UpdateOrderStatus ```php -function captureCharge( - $chargeId, - $request = null, +function updateOrderStatus( + $id, + $body, $idempotencyKey = null) ``` @@ -1164,8 +1881,8 @@ function captureCharge( | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge id | -| request | ``` Optional ``` | Request for capturing a charge | +| id | ``` Required ``` | Order Id | +| body | ``` Required ``` | Update Order Model | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1173,24 +1890,35 @@ function captureCharge( #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new CreateCaptureChargeRequest(); +$id = 'id'; +$body = new UpdateOrderStatusRequest(); $idempotencyKey = 'idempotency-key'; -$result = $charges->captureCharge($chargeId, $request, $idempotencyKey); +$result = $orders->updateOrderStatus($id, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeDueDate") updateChargeDueDate +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the due date from a charge + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.deleteAllOrderItems") deleteAllOrderItems + +> DeleteAllOrderItems ```php -function updateChargeDueDate( - $chargeId, - $request, +function deleteAllOrderItems( + $orderId, $idempotencyKey = null) ``` @@ -1198,8 +1926,7 @@ function updateChargeDueDate( | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge Id | -| request | ``` Required ``` | Request for updating the due date | +| orderId | ``` Required ``` | Order Id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1207,23 +1934,35 @@ function updateChargeDueDate( #### Example Usage ```php -$chargeId = 'charge_id'; -$request = new UpdateChargeDueDateRequest(); +$orderId = 'orderId'; $idempotencyKey = 'idempotency-key'; -$result = $charges->updateChargeDueDate($chargeId, $request, $idempotencyKey); +$result = $orders->deleteAllOrderItems($orderId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.createCharge") createCharge +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new charge + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.createOrderItem") createOrderItem + +> CreateOrderItem ```php -function createCharge( - $request, +function createOrderItem( + $orderId, + $body, $idempotencyKey = null) ``` @@ -1231,7 +1970,8 @@ function createCharge( | Parameter | Tags | Description | |-----------|------|-------------| -| request | ``` Required ``` | Request for creating a charge | +| orderId | ``` Required ``` | Order Id | +| body | ``` Required ``` | Order Item Model | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1239,103 +1979,139 @@ function createCharge( #### Example Usage ```php -$request = new CreateChargeRequest(); +$orderId = 'orderId'; +$body = new OrdersItemsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $charges->createCharge($request, $idempotencyKey); +$result = $orders->createOrderItem($orderId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getChargeTransactions") getChargeTransactions +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderMetadata") updateOrderMetadata -> TODO: Add a method description +> Updates the metadata from an order ```php -function getChargeTransactions( - $chargeId, - $page = null, - $size = null) +function updateOrderMetadata( + $orderId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| chargeId | ``` Required ``` | Charge Id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | +| orderId | ``` Required ``` | The order id | +| body | ``` Required ``` | Request for updating the order metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$chargeId = 'charge_id'; -$page = 32; -$size = 32; +$orderId = 'order_id'; +$body = new OrdersMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $charges->getChargeTransactions($chargeId, $page, $size); +$result = $orders->updateOrderMetadata($orderId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getChargesSummary") getChargesSummary -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrders") getOrders + +> Gets all orders ```php -function getChargesSummary( - $status, +function getOrders( + $page = null, + $size = null, + $code = null, + $status = null, $createdSince = null, - $createdUntil = null) + $createdUntil = null, + $customerId = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| status | ``` Required ``` | TODO: Add a parameter description | -| createdSince | ``` Optional ``` | TODO: Add a parameter description | -| createdUntil | ``` Optional ``` | TODO: Add a parameter description | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| code | ``` Optional ``` | Filter for order's code | +| status | ``` Optional ``` | Filter for order's status | +| createdSince | ``` Optional ``` | Filter for order's creation date start range | +| createdUntil | ``` Optional ``` | Filter for order's creation date end range | +| customerId | ``` Optional ``` | Filter for order's customer id | #### Example Usage ```php +$page = 12; +$size = 12; +$code = 'code'; $status = 'status'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); +$customerId = 'customer_id'; -$result = $charges->getChargesSummary($status, $createdSince, $createdUntil); +$result = $orders->getOrders($page, $size, $code, $status, $createdSince, $createdUntil, $customerId); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".RecipientsController") RecipientsController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` RecipientsController ``` class can be accessed from the API Client. -```php -$recipients = $client->getRecipients(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientMetadata") updateRecipientMetadata +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.createOrder") createOrder -> Updates recipient metadata +> Creates a new Order ```php -function updateRecipientMetadata( - $recipientId, - $request, +function createOrder( + $body, $idempotencyKey = null) ``` @@ -1343,8 +2119,7 @@ function updateRecipientMetadata( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| request | ``` Required ``` | Metadata | +| body | ``` Required ``` | Request for creating an order | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1352,24 +2127,35 @@ function updateRecipientMetadata( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new UpdateMetadataRequest(); +$body = new OrdersRequest(); $idempotencyKey = 'idempotency-key'; -$result = $recipients->updateRecipientMetadata($recipientId, $request, $idempotencyKey); +$result = $orders->createOrder($body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientTransferSettings") updateRecipientTransferSettings -> TODO: Add a method description +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.deleteOrderItem") deleteOrderItem + +> DeleteOrderItem ```php -function updateRecipientTransferSettings( - $recipientId, - $request, +function deleteOrderItem( + $orderId, + $itemId, $idempotencyKey = null) ``` @@ -1377,8 +2163,8 @@ function updateRecipientTransferSettings( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient Identificator | -| request | ``` Required ``` | TODO: Add a parameter description | +| orderId | ``` Required ``` | Order Id | +| itemId | ``` Required ``` | Item Id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1386,165 +2172,180 @@ function updateRecipientTransferSettings( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new UpdateTransferSettingsRequest(); +$orderId = 'orderId'; +$itemId = 'itemId'; $idempotencyKey = 'idempotency-key'; -$result = $recipients->updateRecipientTransferSettings($recipientId, $request, $idempotencyKey); +$result = $orders->deleteOrderItem($orderId, $itemId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipation") getAnticipation +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets an anticipation + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrderItem") getOrderItem + +> GetOrderItem ```php -function getAnticipation( - $recipientId, - $anticipationId) +function getOrderItem( + $orderId, + $itemId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| anticipationId | ``` Required ``` | Anticipation id | +| orderId | ``` Required ``` | Order Id | +| itemId | ``` Required ``` | Item Id | #### Example Usage ```php -$recipientId = 'recipient_id'; -$anticipationId = 'anticipation_id'; +$orderId = 'orderId'; +$itemId = 'itemId'; -$result = $recipients->getAnticipation($recipientId, $anticipationId); +$result = $orders->getOrderItem($orderId, $itemId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipients") getRecipients +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Retrieves paginated recipients information + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderItem") updateOrderItem + +> UpdateOrderItem ```php -function getRecipients( - $page = null, - $size = null) +function updateOrderItem( + $orderId, + $itemId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | +| orderId | ``` Required ``` | Order Id | +| itemId | ``` Required ``` | Item Id | +| body | ``` Required ``` | Item Model | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$page = 196; -$size = 196; +$orderId = 'orderId'; +$itemId = 'itemId'; +$body = new OrdersItemsRequest1(); +$idempotencyKey = 'idempotency-key'; -$result = $recipients->getRecipients($page, $size); +$result = $orders->updateOrderItem($orderId, $itemId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getBalance") getBalance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get balance information for a recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrder") getOrder + +> Gets an order ```php -function getBalance($recipientId) +function getOrder($orderId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | +| orderId | ``` Required ``` | Order id | #### Example Usage ```php -$recipientId = 'recipient_id'; +$orderId = 'order_id'; -$result = $recipients->getBalance($recipientId); +$result = $orders->getOrder($orderId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipations") getAnticipations - -> Retrieves a paginated list of anticipations from a recipient - +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -function getAnticipations( - $recipientId, - $page = null, - $size = null, - $status = null, - $timeframe = null, - $paymentDateSince = null, - $paymentDateUntil = null, - $createdSince = null, - $createdUntil = null) -``` -#### Parameters -| Parameter | Tags | Description | -|-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| status | ``` Optional ``` | Filter for anticipation status | -| timeframe | ``` Optional ``` | Filter for anticipation timeframe | -| paymentDateSince | ``` Optional ``` | Filter for start range for anticipation payment date | -| paymentDateUntil | ``` Optional ``` | Filter for end range for anticipation payment date | -| createdSince | ``` Optional ``` | Filter for start range for anticipation creation date | -| createdUntil | ``` Optional ``` | Filter for end range for anticipation creation date | +[Back to List of Controllers](#list_of_controllers) +## ![Class: ](https://apidocs.io/img/class.png ".PlansController") PlansController +### Get singleton instance -#### Example Usage +The singleton instance of the ``` PlansController ``` class can be accessed from the API Client. ```php -$recipientId = 'recipient_id'; -$page = 196; -$size = 196; -$status = 'status'; -$timeframe = 'timeframe'; -$paymentDateSince = date("D M d, Y G:i"); -$paymentDateUntil = date("D M d, Y G:i"); -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); - -$result = $recipients->getAnticipations($recipientId, $page, $size, $status, $timeframe, $paymentDateSince, $paymentDateUntil, $createdSince, $createdUntil); - +$plans = $client->getPlans(); ``` +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlanItem") updatePlanItem -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createAnticipation") createAnticipation - -> Creates an anticipation +> Updates a plan item ```php -function createAnticipation( - $recipientId, - $request, +function updatePlanItem( + $planId, + $planItemId, + $body, $idempotencyKey = null) ``` @@ -1552,8 +2353,9 @@ function createAnticipation( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| request | ``` Required ``` | Anticipation data | +| planId | ``` Required ``` | Plan id | +| planItemId | ``` Required ``` | Plan item id | +| body | ``` Required ``` | Request for updating the plan item | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1561,24 +2363,37 @@ function createAnticipation( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new CreateAnticipationRequest(); +$planId = 'plan_id'; +$planItemId = 'plan_item_id'; +$body = new PlansItemsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $recipients->createAnticipation($recipientId, $request, $idempotencyKey); +$result = $plans->updatePlanItem($planId, $planItemId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientDefaultBankAccount") updateRecipientDefaultBankAccount +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the default bank account from a recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.deletePlanItem") deletePlanItem + +> Removes an item from a plan ```php -function updateRecipientDefaultBankAccount( - $recipientId, - $request, +function deletePlanItem( + $planId, + $planItemId, $idempotencyKey = null) ``` @@ -1586,8 +2401,8 @@ function updateRecipientDefaultBankAccount( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| request | ``` Required ``` | Bank account data | +| planId | ``` Required ``` | Plan id | +| planItemId | ``` Required ``` | Plan item id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1595,118 +2410,128 @@ function updateRecipientDefaultBankAccount( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new UpdateRecipientBankAccountRequest(); +$planId = 'plan_id'; +$planItemId = 'plan_item_id'; $idempotencyKey = 'idempotency-key'; -$result = $recipients->updateRecipientDefaultBankAccount($recipientId, $request, $idempotencyKey); - -``` - - -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipient") getRecipient - -> Retrieves recipient information - +$result = $plans->deletePlanItem($planId, $planItemId, $idempotencyKey); -```php -function getRecipient($recipientId) ``` -#### Parameters - -| Parameter | Tags | Description | -|-----------|------|-------------| -| recipientId | ``` Required ``` | Recipiend id | - - - -#### Example Usage - -```php -$recipientId = 'recipient_id'; +#### Errors -$result = $recipients->getRecipient($recipientId); +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -``` -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipationLimits") getAnticipationLimits +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlanItem") getPlanItem -> Gets the anticipation limits for a recipient +> Gets a plan item ```php -function getAnticipationLimits( - $recipientId, - $timeframe, - $paymentDate) +function getPlanItem( + $planId, + $planItemId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| timeframe | ``` Required ``` | Timeframe | -| paymentDate | ``` Required ``` | Anticipation payment date | +| planId | ``` Required ``` | Plan id | +| planItemId | ``` Required ``` | Plan item id | #### Example Usage ```php -$recipientId = 'recipient_id'; -$timeframe = 'timeframe'; -$paymentDate = date("D M d, Y G:i"); +$planId = 'plan_id'; +$planItemId = 'plan_item_id'; -$result = $recipients->getAnticipationLimits($recipientId, $timeframe, $paymentDate); +$result = $plans->getPlanItem($planId, $planItemId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getTransfer") getTransfer +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets a transfer + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.createPlanItem") createPlanItem + +> Adds a new item to a plan ```php -function getTransfer( - $recipientId, - $transferId) +function createPlanItem( + $planId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| transferId | ``` Required ``` | Transfer id | +| planId | ``` Required ``` | Plan id | +| body | ``` Required ``` | Request for creating a plan item | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$recipientId = 'recipient_id'; -$transferId = 'transfer_id'; +$planId = 'plan_id'; +$body = new PlansItemsRequest1(); +$idempotencyKey = 'idempotency-key'; -$result = $recipients->getTransfer($recipientId, $transferId); +$result = $plans->createPlanItem($planId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getTransfers") getTransfers +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets a paginated list of transfers for the recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlans") getPlans + +> Gets all plans ```php -function getTransfers( - $recipientId, +function getPlans( $page = null, $size = null, + $name = null, $status = null, + $billingType = null, $createdSince = null, $createdUntil = null) ``` @@ -1715,39 +2540,52 @@ function getTransfers( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | | page | ``` Optional ``` | Page number | | size | ``` Optional ``` | Page size | -| status | ``` Optional ``` | Filter for transfer status | -| createdSince | ``` Optional ``` | Filter for start range of transfer creation date | -| createdUntil | ``` Optional ``` | Filter for end range of transfer creation date | +| name | ``` Optional ``` | Filter for Plan's name | +| status | ``` Optional ``` | Filter for Plan's status | +| billingType | ``` Optional ``` | Filter for plan's billing type | +| createdSince | ``` Optional ``` | Filter for plan's creation date start range | +| createdUntil | ``` Optional ``` | Filter for plan's creation date end range | #### Example Usage ```php -$recipientId = 'recipient_id'; -$page = 196; -$size = 196; +$page = 12; +$size = 12; +$name = 'name'; $status = 'status'; +$billingType = 'billing_type'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); -$result = $recipients->getTransfers($recipientId, $page, $size, $status, $createdSince, $createdUntil); +$result = $plans->getPlans($page, $size, $name, $status, $billingType, $createdSince, $createdUntil); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipient") updateRecipient +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates a recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.createPlan") createPlan + +> Creates a new plan ```php -function updateRecipient( - $recipientId, - $request, +function createPlan( + $body, $idempotencyKey = null) ``` @@ -1755,8 +2593,7 @@ function updateRecipient( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| request | ``` Required ``` | Recipient data | +| body | ``` Required ``` | Request for creating a plan | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1764,55 +2601,74 @@ function updateRecipient( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new UpdateRecipientRequest(); +$body = new PlansRequest(); $idempotencyKey = 'idempotency-key'; -$result = $recipients->updateRecipient($recipientId, $request, $idempotencyKey); +$result = $plans->createPlan($body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createRecipient") createRecipient +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlan") getPlan + +> Gets a plan ```php -function createRecipient( - $request, - $idempotencyKey = null) +function getPlan($planId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| request | ``` Required ``` | Recipient data | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| planId | ``` Required ``` | Plan id | #### Example Usage ```php -$request = new CreateRecipientRequest(); -$idempotencyKey = 'idempotency-key'; +$planId = 'plan_id'; -$result = $recipients->createRecipient($request, $idempotencyKey); +$result = $plans->getPlan($planId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createTransfer") createTransfer +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a transfer for a recipient + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlan") updatePlan + +> Updates a plan ```php -function createTransfer( - $recipientId, - $request, +function updatePlan( + $planId, + $body, $idempotencyKey = null) ``` @@ -1820,8 +2676,8 @@ function createTransfer( | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient Id | -| request | ``` Required ``` | Transfer data | +| planId | ``` Required ``` | Plan id | +| body | ``` Required ``` | Request for updating a plan | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -1829,202 +2685,225 @@ function createTransfer( #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new CreateTransferRequest(); +$planId = 'plan_id'; +$body = new PlansRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $recipients->createTransfer($recipientId, $request, $idempotencyKey); +$result = $plans->updatePlan($planId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createWithdraw") createWithdraw -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.deletePlan") deletePlan + +> Deletes a plan ```php -function createWithdraw( - $recipientId, - $request) +function deletePlan( + $planId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | TODO: Add a parameter description | -| request | ``` Required ``` | TODO: Add a parameter description | +| planId | ``` Required ``` | Plan id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new CreateWithdrawRequest(); +$planId = 'plan_id'; +$idempotencyKey = 'idempotency-key'; -$result = $recipients->createWithdraw($recipientId, $request); +$result = $plans->deletePlan($planId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getWithdrawById") getWithdrawById +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlanMetadata") updatePlanMetadata -> TODO: Add a method description +> Updates the metadata from a plan ```php -function getWithdrawById( - $recipientId, - $withdrawalId) +function updatePlanMetadata( + $planId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | TODO: Add a parameter description | -| withdrawalId | ``` Required ``` | TODO: Add a parameter description | +| planId | ``` Required ``` | The plan id | +| body | ``` Required ``` | Request for updating the plan metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$recipientId = 'recipient_id'; -$withdrawalId = 'withdrawal_id'; +$planId = 'plan_id'; +$body = new PlansMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $recipients->getWithdrawById($recipientId, $withdrawalId); +$result = $plans->updatePlanMetadata($planId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getWithdrawals") getWithdrawals - -> Gets a paginated list of transfers for the recipient - +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -function getWithdrawals( - $recipientId, - $page = null, - $size = null, - $status = null, - $createdSince = null, - $createdUntil = null) -``` -#### Parameters -| Parameter | Tags | Description | -|-----------|------|-------------| -| recipientId | ``` Required ``` | TODO: Add a parameter description | -| page | ``` Optional ``` | TODO: Add a parameter description | -| size | ``` Optional ``` | TODO: Add a parameter description | -| status | ``` Optional ``` | TODO: Add a parameter description | -| createdSince | ``` Optional ``` | TODO: Add a parameter description | -| createdUntil | ``` Optional ``` | TODO: Add a parameter description | +[Back to List of Controllers](#list_of_controllers) +## ![Class: ](https://apidocs.io/img/class.png ".InvoicesController") InvoicesController +### Get singleton instance -#### Example Usage +The singleton instance of the ``` InvoicesController ``` class can be accessed from the API Client. ```php -$recipientId = 'recipient_id'; -$page = 196; -$size = 196; -$status = 'status'; -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); - -$result = $recipients->getWithdrawals($recipientId, $page, $size, $status, $createdSince, $createdUntil); - +$invoices = $client->getInvoices(); ``` +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.createInvoice") createInvoice -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateAutomaticAnticipationSettings") updateAutomaticAnticipationSettings - -> Updates recipient metadata +> Create an Invoice ```php -function updateAutomaticAnticipationSettings( - $recipientId, - $request, - $idempotencyKey = null) +function createInvoice( + $subscriptionId, + $cycleId, + $idempotencyKey = null, + $body = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| recipientId | ``` Required ``` | Recipient id | -| request | ``` Required ``` | Metadata | +| subscriptionId | ``` Required ``` | Subscription Id | +| cycleId | ``` Required ``` | Cycle Id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| body | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$recipientId = 'recipient_id'; -$request = new UpdateAutomaticAnticipationSettingsRequest(); +$subscriptionId = 'subscription_id'; +$cycleId = 'cycle_id'; $idempotencyKey = 'idempotency-key'; +$body = new SubscriptionsCyclesPayRequest(); -$result = $recipients->updateAutomaticAnticipationSettings($recipientId, $request, $idempotencyKey); +$result = $invoices->createInvoice($subscriptionId, $cycleId, $idempotencyKey, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipientByCode") getRecipientByCode +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Retrieves recipient information + + +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getPartialInvoice") getPartialInvoice + +> GetPartialInvoice ```php -function getRecipientByCode($code) +function getPartialInvoice($subscriptionId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| code | ``` Required ``` | Recipient code | +| subscriptionId | ``` Required ``` | Subscription Id | #### Example Usage ```php -$code = 'code'; +$subscriptionId = 'subscription_id'; -$result = $recipients->getRecipientByCode($code); +$result = $invoices->getPartialInvoice($subscriptionId); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".SubscriptionsController") SubscriptionsController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` SubscriptionsController ``` class can be accessed from the API Client. -```php -$subscriptions = $client->getSubscriptions(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createDiscount") createDiscount +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.updateInvoiceStatus") updateInvoiceStatus -> Creates a discount +> Updates the status from an invoice ```php -function createDiscount( - $subscriptionId, - $request, +function updateInvoiceStatus( + $invoiceId, + $body, $idempotencyKey = null) ``` @@ -2032,8 +2911,8 @@ function createDiscount( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Required ``` | Request for creating a discount | +| invoiceId | ``` Required ``` | Invoice Id | +| body | ``` Required ``` | Request for updating an invoice's status | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2041,92 +2920,74 @@ function createDiscount( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new CreateDiscountRequest(); +$invoiceId = 'invoice_id'; +$body = new UpdateCurrentCycleStatusRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createDiscount($subscriptionId, $request, $idempotencyKey); - -``` - - -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionItem") getSubscriptionItem - -> Get Subscription Item - +$result = $invoices->updateInvoiceStatus($invoiceId, $body, $idempotencyKey); -```php -function getSubscriptionItem( - $subscriptionId, - $itemId) ``` -#### Parameters - -| Parameter | Tags | Description | -|-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| itemId | ``` Required ``` | Item id | - - - -#### Example Usage - -```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; +#### Errors -$result = $subscriptions->getSubscriptionItem($subscriptionId, $itemId); +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -``` -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteUsage") deleteUsage +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getInvoice") getInvoice -> Deletes a usage +> Gets an invoice ```php -function deleteUsage( - $subscriptionId, - $itemId, - $usageId, - $idempotencyKey = null) +function getInvoice($invoiceId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| itemId | ``` Required ``` | The subscription item id | -| usageId | ``` Required ``` | The usage id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| invoiceId | ``` Required ``` | Invoice Id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; -$usageId = 'usage_id'; -$idempotencyKey = 'idempotency-key'; +$invoiceId = 'invoice_id'; -$result = $subscriptions->deleteUsage($subscriptionId, $itemId, $usageId, $idempotencyKey); +$result = $invoices->getInvoice($invoiceId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.cancelSubscription") cancelSubscription +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.cancelInvoice") cancelInvoice -> Cancels a subscription +> Cancels an invoice ```php -function cancelSubscription( - $subscriptionId, - $request = null, +function cancelInvoice( + $invoiceId, $idempotencyKey = null) ``` @@ -2134,8 +2995,7 @@ function cancelSubscription( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Optional ``` | Request for cancelling a subscription | +| invoiceId | ``` Required ``` | Invoice id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2143,24 +3003,35 @@ function cancelSubscription( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new CreateCancelSubscriptionRequest(); +$invoiceId = 'invoice_id'; $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->cancelSubscription($subscriptionId, $request, $idempotencyKey); +$result = $invoices->cancelInvoice($invoiceId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteIncrement") deleteIncrement +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Deletes a increment + + +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.updateInvoiceMetadata") updateInvoiceMetadata + +> Updates the metadata from an invoice ```php -function deleteIncrement( - $subscriptionId, - $incrementId, +function updateInvoiceMetadata( + $invoiceId, + $body, $idempotencyKey = null) ``` @@ -2168,8 +3039,8 @@ function deleteIncrement( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| incrementId | ``` Required ``` | Increment id | +| invoiceId | ``` Required ``` | The invoice id | +| body | ``` Required ``` | Request for updating the invoice metadata | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2177,89 +3048,118 @@ function deleteIncrement( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$incrementId = 'increment_id'; +$invoiceId = 'invoice_id'; +$body = new InvoicesMetadataRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->deleteIncrement($subscriptionId, $incrementId, $idempotencyKey); +$result = $invoices->updateInvoiceMetadata($invoiceId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionCycleById") getSubscriptionCycleById +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getInvoices") getInvoices -> TODO: Add a method description +> Gets all invoices ```php -function getSubscriptionCycleById( - $subscriptionId, - $cycleId) +function getInvoices( + $page = null, + $size = null, + $code = null, + $customerId = null, + $subscriptionId = null, + $createdSince = null, + $createdUntil = null, + $status = null, + $dueSince = null, + $dueUntil = null, + $customerDocument = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| cycleId | ``` Required ``` | TODO: Add a parameter description | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| code | ``` Optional ``` | Filter for Invoice's code | +| customerId | ``` Optional ``` | Filter for Invoice's customer id | +| subscriptionId | ``` Optional ``` | Filter for Invoice's subscription id | +| createdSince | ``` Optional ``` | Filter for Invoice's creation date start range | +| createdUntil | ``` Optional ``` | Filter for Invoices creation date end range | +| status | ``` Optional ``` | Filter for Invoice's status | +| dueSince | ``` Optional ``` | Filter for Invoice's due date start range | +| dueUntil | ``` Optional ``` | Filter for Invoice's due date end range | +| customerDocument | ``` Optional ``` | Fillter for invoice's document | #### Example Usage ```php +$page = 12; +$size = 12; +$code = 'code'; +$customerId = 'customer_id'; $subscriptionId = 'subscription_id'; -$cycleId = 'cycleId'; +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); +$status = 'status'; +$dueSince = date("D M d, Y G:i"); +$dueUntil = date("D M d, Y G:i"); +$customerDocument = 'customer_document'; -$result = $subscriptions->getSubscriptionCycleById($subscriptionId, $cycleId); +$result = $invoices->getInvoices($page, $size, $code, $customerId, $subscriptionId, $createdSince, $createdUntil, $status, $dueSince, $dueUntil, $customerDocument); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionStartAt") updateSubscriptionStartAt - -> Updates the start at date from a subscription - +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -function updateSubscriptionStartAt( - $subscriptionId, - $request, - $idempotencyKey = null) -``` -#### Parameters -| Parameter | Tags | Description | -|-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| request | ``` Required ``` | Request for updating the subscription start date | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +[Back to List of Controllers](#list_of_controllers) +## ![Class: ](https://apidocs.io/img/class.png ".CustomersController") CustomersController +### Get singleton instance -#### Example Usage +The singleton instance of the ``` CustomersController ``` class can be accessed from the API Client. ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionStartAtRequest(); -$idempotencyKey = 'idempotency-key'; - -$result = $subscriptions->updateSubscriptionStartAt($subscriptionId, $request, $idempotencyKey); - +$customers = $client->getCustomers(); ``` +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createAccessToken") createAccessToken -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionPaymentMethod") updateSubscriptionPaymentMethod - -> Updates the payment method from a subscription +> Creates a access token for a customer ```php -function updateSubscriptionPaymentMethod( - $subscriptionId, - $request, +function createAccessToken( + $customerId, + $body, $idempotencyKey = null) ``` @@ -2267,8 +3167,8 @@ function updateSubscriptionPaymentMethod( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Required ``` | Request for updating the paymentmethod from a subscription | +| customerId | ``` Required ``` | Customer Id | +| body | ``` Required ``` | Request for creating a access token | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2276,56 +3176,81 @@ function updateSubscriptionPaymentMethod( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionPaymentMethodRequest(); +$customerId = 'customer_id'; +$body = new CustomersAccessTokensRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->updateSubscriptionPaymentMethod($subscriptionId, $request, $idempotencyKey); +$result = $customers->createAccessToken($customerId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateCurrentCycleStatus") updateCurrentCycleStatus +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAccessTokens") getAccessTokens -> TODO: Add a method description +> Get all access tokens from a customer ```php -function updateCurrentCycleStatus( - $subscriptionId, - $request, - $idempotencyKey = null) +function getAccessTokens( + $customerId, + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| request | ``` Required ``` | Request for updating the end date of the subscription current status | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| customerId | ``` Required ``` | Customer Id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateCurrentCycleStatusRequest(); -$idempotencyKey = 'idempotency-key'; +$customerId = 'customer_id'; +$page = 103; +$size = 103; -$subscriptions->updateCurrentCycleStatus($subscriptionId, $request, $idempotencyKey); +$result = $customers->getAccessTokens($customerId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createSubscription") createSubscription +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new subscription + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCustomer") updateCustomer + +> Updates a customer ```php -function createSubscription( +function updateCustomer( + $customerId, $body, $idempotencyKey = null) ``` @@ -2334,7 +3259,8 @@ function createSubscription( | Parameter | Tags | Description | |-----------|------|-------------| -| body | ``` Required ``` | Request for creating a subscription | +| customerId | ``` Required ``` | Customer id | +| body | ``` Required ``` | Request for updating a customer | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2342,134 +3268,160 @@ function createSubscription( #### Example Usage ```php -$body = new CreateSubscriptionRequest(); +$customerId = 'customer_id'; +$body = new CustomersRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createSubscription($body, $idempotencyKey); +$result = $customers->updateCustomer($customerId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsagesDetails") getUsagesDetails +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> TODO: Add a method description + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCustomer") getCustomer + +> Get a customer ```php -function getUsagesDetails( - $subscriptionId, - $cycleId = null, - $size = null, - $page = null, - $itemId = null, - $group = null) +function getCustomer($customerId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Identifier | -| cycleId | ``` Optional ``` | Cycle id | -| size | ``` Optional ``` | Page size | -| page | ``` Optional ``` | Page number | -| itemId | ``` Optional ``` | Identificador do item | -| group | ``` Optional ``` | identificador da loja (account) de cada item | +| customerId | ``` Required ``` | Customer Id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$cycleId = 'cycle_id'; -$size = 196; -$page = 196; -$itemId = 'item_id'; -$group = 'group'; +$customerId = 'customer_id'; -$result = $subscriptions->getUsagesDetails($subscriptionId, $cycleId, $size, $page, $itemId, $group); +$result = $customers->getCustomer($customerId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.renewSubscription") renewSubscription +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAccessTokens") deleteAccessTokens -> TODO: Add a method description +> Delete a Customer's access tokens ```php -function renewSubscription( - $subscriptionId, - $idempotencyKey = null) +function deleteAccessTokens($customerId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | TODO: Add a parameter description | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| customerId | ``` Required ``` | Customer Id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$idempotencyKey = 'idempotency-key'; +$customerId = 'customer_id'; -$result = $subscriptions->renewSubscription($subscriptionId, $idempotencyKey); +$result = $customers->deleteAccessTokens($customerId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionItem") updateSubscriptionItem -> Updates a subscription item + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAddresses") getAddresses + +> Gets all adressess from a customer ```php -function updateSubscriptionItem( - $subscriptionId, - $itemId, - $body, - $idempotencyKey = null) +function getAddresses( + $customerId, + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| itemId | ``` Required ``` | Item id | -| body | ``` Required ``` | Request for updating a subscription item | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| customerId | ``` Required ``` | Customer id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; -$body = new UpdateSubscriptionItemRequest(); -$idempotencyKey = 'idempotency-key'; +$customerId = 'customer_id'; +$page = 103; +$size = 103; -$result = $subscriptions->updateSubscriptionItem($subscriptionId, $itemId, $body, $idempotencyKey); +$result = $customers->getAddresses($customerId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createAnUsage") createAnUsage +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Create Usage + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createAddress") createAddress + +> Creates a new address for a customer ```php -function createAnUsage( - $subscriptionId, - $itemId, +function createAddress( + $customerId, + $body, $idempotencyKey = null) ``` @@ -2477,8 +3429,8 @@ function createAnUsage( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| itemId | ``` Required ``` | Item id | +| customerId | ``` Required ``` | Customer Id | +| body | ``` Required ``` | Request for creating an address | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2486,55 +3438,79 @@ function createAnUsage( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; +$customerId = 'customer_id'; +$body = new CustomersAddressesRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createAnUsage($subscriptionId, $itemId, $idempotencyKey); +$result = $customers->createAddress($customerId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getIncrementById") getIncrementById +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> TODO: Add a method description -```php -function getIncrementById( - $subscriptionId, - $incrementId) +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAccessToken") getAccessToken + +> Get a Customer's access token + + +```php +function getAccessToken( + $customerId, + $tokenId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription Id | -| incrementId | ``` Required ``` | The increment Id | +| customerId | ``` Required ``` | Customer Id | +| tokenId | ``` Required ``` | Token Id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$incrementId = 'increment_id'; +$customerId = 'customer_id'; +$tokenId = 'token_id'; -$result = $subscriptions->getIncrementById($subscriptionId, $incrementId); +$result = $customers->getAccessToken($customerId, $tokenId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteDiscount") deleteDiscount +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Deletes a discount + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAccessToken") deleteAccessToken + +> Delete a customer's access token ```php -function deleteDiscount( - $subscriptionId, - $discountId, +function deleteAccessToken( + $customerId, + $tokenId, $idempotencyKey = null) ``` @@ -2542,8 +3518,8 @@ function deleteDiscount( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| discountId | ``` Required ``` | Discount Id | +| customerId | ``` Required ``` | Customer Id | +| tokenId | ``` Required ``` | Token Id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2551,58 +3527,79 @@ function deleteDiscount( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$discountId = 'discount_id'; +$customerId = 'customer_id'; +$tokenId = 'token_id'; $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->deleteDiscount($subscriptionId, $discountId, $idempotencyKey); +$result = $customers->deleteAccessToken($customerId, $tokenId, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getIncrements") getIncrements -> TODO: Add a method description +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getAddress") getAddress + +> Get a customer's address ```php -function getIncrements( - $subscriptionId, - $page = null, - $size = null) +function getAddress( + $customerId, + $addressId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | +| customerId | ``` Required ``` | Customer id | +| addressId | ``` Required ``` | Address Id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$page = 196; -$size = 196; +$customerId = 'customer_id'; +$addressId = 'address_id'; -$result = $subscriptions->getIncrements($subscriptionId, $page, $size); +$result = $customers->getAddress($customerId, $addressId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createUsage") createUsage +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateAddress") updateAddress -> Creates a usage +> Updates an address ```php -function createUsage( - $subscriptionId, - $itemId, +function updateAddress( + $customerId, + $addressId, $body, $idempotencyKey = null) ``` @@ -2611,9 +3608,9 @@ function createUsage( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| itemId | ``` Required ``` | Item id | -| body | ``` Required ``` | Request for creating a usage | +| customerId | ``` Required ``` | Customer Id | +| addressId | ``` Required ``` | Address Id | +| body | ``` Required ``` | Request for updating an address | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2621,25 +3618,37 @@ function createUsage( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; -$body = new CreateUsageRequest(); +$customerId = 'customer_id'; +$addressId = 'address_id'; +$body = new CustomersAddressesRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createUsage($subscriptionId, $itemId, $body, $idempotencyKey); +$result = $customers->updateAddress($customerId, $addressId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createSubscriptionItem") createSubscriptionItem +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new Subscription item + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteAddress") deleteAddress + +> Delete a Customer's address ```php -function createSubscriptionItem( - $subscriptionId, - $request, +function deleteAddress( + $customerId, + $addressId, $idempotencyKey = null) ``` @@ -2647,8 +3656,8 @@ function createSubscriptionItem( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Required ``` | Request for creating a subscription item | +| customerId | ``` Required ``` | Customer Id | +| addressId | ``` Required ``` | Address Id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2656,73 +3665,36 @@ function createSubscriptionItem( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new CreateSubscriptionItemRequest(); +$customerId = 'customer_id'; +$addressId = 'address_id'; $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createSubscriptionItem($subscriptionId, $request, $idempotencyKey); - -``` - - -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsages") getUsages - -> Lists all usages from a subscription item - +$result = $customers->deleteAddress($customerId, $addressId, $idempotencyKey); -```php -function getUsages( - $subscriptionId, - $itemId, - $page = null, - $size = null, - $code = null, - $group = null, - $usedSince = null, - $usedUntil = null) ``` -#### Parameters - -| Parameter | Tags | Description | -|-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| itemId | ``` Required ``` | The subscription item id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| code | ``` Optional ``` | Identification code in the client system | -| group | ``` Optional ``` | Identification group in the client system | -| usedSince | ``` Optional ``` | TODO: Add a parameter description | -| usedUntil | ``` Optional ``` | TODO: Add a parameter description | - +#### Errors +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -#### Example Usage - -```php -$subscriptionId = 'subscription_id'; -$itemId = 'item_id'; -$page = 196; -$size = 196; -$code = 'code'; -$group = 'group'; -$usedSince = date("D M d, Y G:i"); -$usedUntil = date("D M d, Y G:i"); - -$result = $subscriptions->getUsages($subscriptionId, $itemId, $page, $size, $code, $group, $usedSince, $usedUntil); - -``` -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionBillingDate") updateSubscriptionBillingDate +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createCard") createCard -> Updates the billing date from a subscription +> Creates a new card for a customer ```php -function updateSubscriptionBillingDate( - $subscriptionId, - $request, +function createCard( + $customerId, + $body, $idempotencyKey = null) ``` @@ -2730,8 +3702,8 @@ function updateSubscriptionBillingDate( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| request | ``` Required ``` | Request for updating the subscription billing date | +| customerId | ``` Required ``` | Customer id | +| body | ``` Required ``` | Request for creating a card | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2739,236 +3711,273 @@ function updateSubscriptionBillingDate( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionBillingDateRequest(); +$customerId = 'customer_id'; +$body = new CustomersCardsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->updateSubscriptionBillingDate($subscriptionId, $request, $idempotencyKey); +$result = $customers->createCard($customerId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateLatestPeriodEndAt") updateLatestPeriodEndAt -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCards") getCards + +> Get all cards from a customer ```php -function updateLatestPeriodEndAt( - $subscriptionId, - $request, - $idempotencyKey = null) +function getCards( + $customerId, + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | TODO: Add a parameter description | -| request | ``` Required ``` | Request for updating the end date of the current signature cycle | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| customerId | ``` Required ``` | Customer Id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateCurrentCycleEndDateRequest(); -$idempotencyKey = 'idempotency-key'; +$customerId = 'customer_id'; +$page = 103; +$size = 103; -$result = $subscriptions->updateLatestPeriodEndAt($subscriptionId, $request, $idempotencyKey); +$result = $customers->getCards($customerId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionCycles") getSubscriptionCycles +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.renewCard") renewCard -> TODO: Add a method description +> Renew a card ```php -function getSubscriptionCycles( - $subscriptionId, - $page, - $size) +function renewCard( + $customerId, + $cardId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| page | ``` Required ``` | Page number | -| size | ``` Required ``` | Page size | +| customerId | ``` Required ``` | Customer id | +| cardId | ``` Required ``` | Card Id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$page = 'page'; -$size = 'size'; +$customerId = 'customer_id'; +$cardId = 'card_id'; +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->getSubscriptionCycles($subscriptionId, $page, $size); +$result = $customers->renewCard($customerId, $cardId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptions") getSubscriptions +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets all subscriptions + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.createCustomer") createCustomer + +> Creates a new customer ```php -function getSubscriptions( - $page = null, - $size = null, - $code = null, - $billingType = null, - $customerId = null, - $planId = null, - $cardId = null, - $status = null, - $nextBillingSince = null, - $nextBillingUntil = null, - $createdSince = null, - $createdUntil = null) +function createCustomer( + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| code | ``` Optional ``` | Filter for subscription's code | -| billingType | ``` Optional ``` | Filter for subscription's billing type | -| customerId | ``` Optional ``` | Filter for subscription's customer id | -| planId | ``` Optional ``` | Filter for subscription's plan id | -| cardId | ``` Optional ``` | Filter for subscription's card id | -| status | ``` Optional ``` | Filter for subscription's status | -| nextBillingSince | ``` Optional ``` | Filter for subscription's next billing date start range | -| nextBillingUntil | ``` Optional ``` | Filter for subscription's next billing date end range | -| createdSince | ``` Optional ``` | Filter for subscription's creation date start range | -| createdUntil | ``` Optional ``` | Filter for subscriptions creation date end range | +| body | ``` Required ``` | Request for creating a customer | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$page = 237; -$size = 237; -$code = 'code'; -$billingType = 'billing_type'; -$customerId = 'customer_id'; -$planId = 'plan_id'; -$cardId = 'card_id'; -$status = 'status'; -$nextBillingSince = date("D M d, Y G:i"); -$nextBillingUntil = date("D M d, Y G:i"); -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); +$body = new CustomersRequest1(); +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->getSubscriptions($page, $size, $code, $billingType, $customerId, $planId, $cardId, $status, $nextBillingSince, $nextBillingUntil, $createdSince, $createdUntil); +$result = $customers->createCustomer($body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getDiscountById") getDiscountById +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCustomers") getCustomers -> TODO: Add a method description +> Get all Customers ```php -function getDiscountById( - $subscriptionId, - $discountId) +function getCustomers( + $name = null, + $document = null, + $page = 1, + $size = 10, + $email = null, + $code = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| discountId | ``` Required ``` | TODO: Add a parameter description | +| name | ``` Optional ``` | Name of the Customer | +| document | ``` Optional ``` | Document of the Customer | +| page | ``` Optional ``` ``` DefaultValue ``` | Current page the the search | +| size | ``` Optional ``` ``` DefaultValue ``` | Quantity pages of the search | +| email | ``` Optional ``` | Customer's email | +| code | ``` Optional ``` | Customer's code | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$discountId = 'discountId'; +$name = 'name'; +$document = 'document'; +$page = 1; +$size = 10; +$email = 'email'; +$code = 'Code'; -$result = $subscriptions->getDiscountById($subscriptionId, $discountId); +$result = $customers->getCustomers($name, $document, $page, $size, $email, $code); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscriptionItems") getSubscriptionItems +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Get Subscription Items + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCustomerMetadata") updateCustomerMetadata + +> Updates the metadata a customer ```php -function getSubscriptionItems( - $subscriptionId, - $page = null, - $size = null, - $name = null, - $code = null, - $status = null, - $description = null, - $createdSince = null, - $createdUntil = null) +function updateCustomerMetadata( + $customerId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| name | ``` Optional ``` | The item name | -| code | ``` Optional ``` | Identification code in the client system | -| status | ``` Optional ``` | The item statis | -| description | ``` Optional ``` | The item description | -| createdSince | ``` Optional ``` | Filter for item's creation date start range | -| createdUntil | ``` Optional ``` | Filter for item's creation date end range | +| customerId | ``` Required ``` | The customer id | +| body | ``` Required ``` | Request for updating the customer metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$page = 237; -$size = 237; -$name = 'name'; -$code = 'code'; -$status = 'status'; -$description = 'description'; -$createdSince = 'created_since'; -$createdUntil = 'created_until'; +$customerId = 'customer_id'; +$body = new CustomersMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->getSubscriptionItems($subscriptionId, $page, $size, $name, $code, $status, $description, $createdSince, $createdUntil); +$result = $customers->updateCustomerMetadata($customerId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionMiniumPrice") updateSubscriptionMiniumPrice +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Atualização do valor mínimo da assinatura + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.updateCard") updateCard + +> Updates a card ```php -function updateSubscriptionMiniumPrice( - $subscriptionId, - $request, +function updateCard( + $customerId, + $cardId, + $body, $idempotencyKey = null) ``` @@ -2976,8 +3985,9 @@ function updateSubscriptionMiniumPrice( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| request | ``` Required ``` | Request da requisição com o valor mínimo que será configurado | +| customerId | ``` Required ``` | Customer Id | +| cardId | ``` Required ``` | Card id | +| body | ``` Required ``` | Request for updating a card | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -2985,187 +3995,269 @@ function updateSubscriptionMiniumPrice( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionMinimumPriceRequest(); +$customerId = 'customer_id'; +$cardId = 'card_id'; +$body = new CustomersCardsRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->updateSubscriptionMiniumPrice($subscriptionId, $request, $idempotencyKey); +$result = $customers->updateCard($customerId, $cardId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getSubscription") getSubscription +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets a subscription + + +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.deleteCard") deleteCard + +> Delete a customer's card ```php -function getSubscription($subscriptionId) +function deleteCard( + $customerId, + $cardId, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | +| customerId | ``` Required ``` | Customer Id | +| cardId | ``` Required ``` | Card Id | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$subscriptionId = 'subscription_id'; +$customerId = 'customer_id'; +$cardId = 'card_id'; +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->getSubscription($subscriptionId); +$result = $customers->deleteCard($customerId, $cardId, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionAffiliationId") updateSubscriptionAffiliationId -> TODO: Add a method description +### ![Method: ](https://apidocs.io/img/method.png ".CustomersController.getCard") getCard + +> Get a customer's card ```php -function updateSubscriptionAffiliationId( - $subscriptionId, - $request, - $idempotencyKey = null) +function getCard( + $customerId, + $cardId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | TODO: Add a parameter description | -| request | ``` Required ``` | Request for updating a subscription affiliation id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| customerId | ``` Required ``` | Customer id | +| cardId | ``` Required ``` | Card id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionAffiliationIdRequest(); -$idempotencyKey = 'idempotency-key'; +$customerId = 'customer_id'; +$cardId = 'card_id'; -$result = $subscriptions->updateSubscriptionAffiliationId($subscriptionId, $request, $idempotencyKey); +$result = $customers->getCard($customerId, $cardId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.deleteSubscriptionItem") deleteSubscriptionItem +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Deletes a subscription item + + +[Back to List of Controllers](#list_of_controllers) + +## ![Class: ](https://apidocs.io/img/class.png ".ChargesController") ChargesController + +### Get singleton instance + +The singleton instance of the ``` ChargesController ``` class can be accessed from the API Client. + +```php +$charges = $client->getCharges(); +``` + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getCharge") getCharge + +> Get a charge from its id ```php -function deleteSubscriptionItem( - $subscriptionId, - $subscriptionItemId, - $idempotencyKey = null) +function getCharge($chargeId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| subscriptionItemId | ``` Required ``` | Subscription item id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| chargeId | ``` Required ``` | Charge id | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$subscriptionItemId = 'subscription_item_id'; -$idempotencyKey = 'idempotency-key'; +$chargeId = 'charge_id'; -$result = $subscriptions->deleteSubscriptionItem($subscriptionId, $subscriptionItemId, $idempotencyKey); +$result = $charges->getCharge($chargeId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionCard") updateSubscriptionCard +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the credit card from a subscription + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.cancelCharge") cancelCharge + +> Cancel a charge ```php -function updateSubscriptionCard( - $subscriptionId, - $request, - $idempotencyKey = null) +function cancelCharge( + $chargeId, + $idempotencyKey = null, + $body = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Required ``` | Request for updating a card | +| chargeId | ``` Required ``` | Charge id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| body | ``` Optional ``` | Request for cancelling a charge | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionCardRequest(); +$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; +$body = new ChargesRequest(); -$result = $subscriptions->updateSubscriptionCard($subscriptionId, $request, $idempotencyKey); +$result = $charges->cancelCharge($chargeId, $idempotencyKey, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionMetadata") updateSubscriptionMetadata +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the metadata from a subscription + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.confirmPayment") confirmPayment + +> ConfirmPayment ```php -function updateSubscriptionMetadata( - $subscriptionId, - $request, - $idempotencyKey = null) +function confirmPayment( + $chargeId, + $idempotencyKey = null, + $body = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| request | ``` Required ``` | Request for updating the subscrption metadata | +| chargeId | ``` Required ``` | TODO: Add a parameter description | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| body | ``` Optional ``` | Request for confirm payment | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateMetadataRequest(); +$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; +$body = new CreateConfirmPaymentRequest(); -$result = $subscriptions->updateSubscriptionMetadata($subscriptionId, $request, $idempotencyKey); +$result = $charges->confirmPayment($chargeId, $idempotencyKey, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSubscriptionDueDays") updateSubscriptionDueDays +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the boleto due days from a subscription + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeCard") updateChargeCard + +> Updates the card from a charge ```php -function updateSubscriptionDueDays( - $subscriptionId, - $request, +function updateChargeCard( + $chargeId, + $body, $idempotencyKey = null) ``` @@ -3173,8 +4265,8 @@ function updateSubscriptionDueDays( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| request | ``` Required ``` | TODO: Add a parameter description | +| chargeId | ``` Required ``` | Charge id | +| body | ``` Required ``` | Request for updating a charge's card | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3182,58 +4274,99 @@ function updateSubscriptionDueDays( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new UpdateSubscriptionDueDaysRequest(); +$chargeId = 'charge_id'; +$body = new ChargesCardRequest(); $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->updateSubscriptionDueDays($subscriptionId, $request, $idempotencyKey); +$result = $charges->updateChargeCard($chargeId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getDiscounts") getDiscounts +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> TODO: Add a method description + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getCharges") getCharges + +> Lists all charges ```php -function getDiscounts( - $subscriptionId, - $page, - $size) +function getCharges( + $page = null, + $size = null, + $code = null, + $status = null, + $paymentMethod = null, + $customerId = null, + $orderId = null, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription id | -| page | ``` Required ``` | Page number | -| size | ``` Required ``` | Page size | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| code | ``` Optional ``` | Filter for charge's code | +| status | ``` Optional ``` | Filter for charge's status | +| paymentMethod | ``` Optional ``` | Filter for charge's payment method | +| customerId | ``` Optional ``` | Filter for charge's customer id | +| orderId | ``` Optional ``` | Filter for charge's order id | +| createdSince | ``` Optional ``` | Filter for the beginning of the range for charge's creation | +| createdUntil | ``` Optional ``` | Filter for the end of the range for charge's creation | + +#### Example Usage + +```php +$page = 103; +$size = 103; +$code = 'code'; +$status = 'status'; +$paymentMethod = 'payment_method'; +$customerId = 'customer_id'; +$orderId = 'order_id'; +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); + +$result = $charges->getCharges($page, $size, $code, $status, $paymentMethod, $customerId, $orderId, $createdSince, $createdUntil); -#### Example Usage +``` -```php -$subscriptionId = 'subscription_id'; -$page = 237; -$size = 237; +#### Errors -$result = $subscriptions->getDiscounts($subscriptionId, $page, $size); +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -``` -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.createIncrement") createIncrement +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.retryCharge") retryCharge -> Creates a increment +> Retries a charge ```php -function createIncrement( - $subscriptionId, - $request, +function retryCharge( + $chargeId, $idempotencyKey = null) ``` @@ -3241,8 +4374,7 @@ function createIncrement( | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription id | -| request | ``` Required ``` | Request for creating a increment | +| chargeId | ``` Required ``` | Charge id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3250,162 +4382,218 @@ function createIncrement( #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$request = new CreateIncrementRequest(); +$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; -$result = $subscriptions->createIncrement($subscriptionId, $request, $idempotencyKey); +$result = $charges->retryCharge($chargeId, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.getUsageReport") getUsageReport +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> TODO: Add a method description + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargePaymentMethod") updateChargePaymentMethod + +> Updates a charge's payment method ```php -function getUsageReport( - $subscriptionId, - $periodId) +function updateChargePaymentMethod( + $chargeId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | The subscription Id | -| periodId | ``` Required ``` | The period Id | +| chargeId | ``` Required ``` | Charge id | +| body | ``` Required ``` | Request for updating the payment method from a charge | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$periodId = 'period_id'; +$chargeId = 'charge_id'; +$body = new ChargesPaymentMethodRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->getUsageReport($subscriptionId, $periodId); +$result = $charges->updateChargePaymentMethod($chargeId, $body, $idempotencyKey); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".SubscriptionsController.updateSplitSubscription") updateSplitSubscription -> TODO: Add a method description +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeMetadata") updateChargeMetadata + +> Updates the metadata from a charge ```php -function updateSplitSubscription( - $id, - $request) +function updateChargeMetadata( + $chargeId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| id | ``` Required ``` | Subscription's id | -| request | ``` Required ``` | TODO: Add a parameter description | +| chargeId | ``` Required ``` | The charge id | +| body | ``` Required ``` | Request for updating the charge metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$id = 'id'; -$request = new UpdateSubscriptionSplitRequest(); +$chargeId = 'charge_id'; +$body = new ChargesMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $subscriptions->updateSplitSubscription($id, $request); +$result = $charges->updateChargeMetadata($chargeId, $body, $idempotencyKey); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".InvoicesController") InvoicesController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` InvoicesController ``` class can be accessed from the API Client. -```php -$invoices = $client->getInvoices(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.createInvoice") createInvoice +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.captureCharge") captureCharge -> Create an Invoice +> Captures a charge ```php -function createInvoice( - $subscriptionId, - $cycleId, - $request = null, - $idempotencyKey = null) +function captureCharge( + $chargeId, + $idempotencyKey = null, + $body = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | -| cycleId | ``` Required ``` | Cycle Id | -| request | ``` Optional ``` | TODO: Add a parameter description | +| chargeId | ``` Required ``` | Charge id | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| body | ``` Optional ``` | Request for capturing a charge | #### Example Usage ```php -$subscriptionId = 'subscription_id'; -$cycleId = 'cycle_id'; -$request = new CreateInvoiceRequest(); +$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; +$body = new ChargesCaptureRequest(); -$result = $invoices->createInvoice($subscriptionId, $cycleId, $request, $idempotencyKey); +$result = $charges->captureCharge($chargeId, $idempotencyKey, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getPartialInvoice") getPartialInvoice +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.updateChargeDueDate") updateChargeDueDate -> TODO: Add a method description +> Updates the due date from a charge ```php -function getPartialInvoice($subscriptionId) +function updateChargeDueDate( + $chargeId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| subscriptionId | ``` Required ``` | Subscription Id | +| chargeId | ``` Required ``` | Charge Id | +| body | ``` Required ``` | Request for updating the due date | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$subscriptionId = 'subscription_id'; +$chargeId = 'charge_id'; +$body = new ChargesDueDateRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $invoices->getPartialInvoice($subscriptionId); +$result = $charges->updateChargeDueDate($chargeId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.updateInvoiceStatus") updateInvoiceStatus +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the status from an invoice + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.createCharge") createCharge + +> Creates a new charge ```php -function updateInvoiceStatus( - $invoiceId, - $request, +function createCharge( + $body, $idempotencyKey = null) ``` @@ -3413,8 +4601,7 @@ function updateInvoiceStatus( | Parameter | Tags | Description | |-----------|------|-------------| -| invoiceId | ``` Required ``` | Invoice Id | -| request | ``` Required ``` | Request for updating an invoice's status | +| body | ``` Required ``` | Request for creating a charge | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3422,142 +4609,185 @@ function updateInvoiceStatus( #### Example Usage ```php -$invoiceId = 'invoice_id'; -$request = new UpdateInvoiceStatusRequest(); +$body = new ChargesRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $invoices->updateInvoiceStatus($invoiceId, $request, $idempotencyKey); +$result = $charges->createCharge($body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getInvoice") getInvoice +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets an invoice + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getChargeTransactions") getChargeTransactions + +> GetChargeTransactions ```php -function getInvoice($invoiceId) +function getChargeTransactions( + $chargeId, + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| invoiceId | ``` Required ``` | Invoice Id | +| chargeId | ``` Required ``` | Charge Id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$invoiceId = 'invoice_id'; +$chargeId = 'charge_id'; +$page = 62; +$size = 62; -$result = $invoices->getInvoice($invoiceId); +$result = $charges->getChargeTransactions($chargeId, $page, $size); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.updateInvoiceMetadata") updateInvoiceMetadata +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the metadata from an invoice + + +### ![Method: ](https://apidocs.io/img/method.png ".ChargesController.getChargesSummary") getChargesSummary + +> GetChargesSummary ```php -function updateInvoiceMetadata( - $invoiceId, - $request, - $idempotencyKey = null) +function getChargesSummary( + $status, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| invoiceId | ``` Required ``` | The invoice id | -| request | ``` Required ``` | Request for updating the invoice metadata | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| status | ``` Required ``` | TODO: Add a parameter description | +| createdSince | ``` Optional ``` | TODO: Add a parameter description | +| createdUntil | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$invoiceId = 'invoice_id'; -$request = new UpdateMetadataRequest(); -$idempotencyKey = 'idempotency-key'; +$status = 'status'; +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); -$result = $invoices->updateInvoiceMetadata($invoiceId, $request, $idempotencyKey); +$result = $charges->getChargesSummary($status, $createdSince, $createdUntil); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.getInvoices") getInvoices +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets all invoices +[Back to List of Controllers](#list_of_controllers) + +## ![Class: ](https://apidocs.io/img/class.png ".RecipientsController") RecipientsController + +### Get singleton instance + +The singleton instance of the ``` RecipientsController ``` class can be accessed from the API Client. + ```php -function getInvoices( - $page = null, - $size = null, - $code = null, - $customerId = null, - $subscriptionId = null, - $createdSince = null, - $createdUntil = null, - $status = null, - $dueSince = null, - $dueUntil = null, - $customerDocument = null) +$recipients = $client->getRecipients(); +``` + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientMetadata") updateRecipientMetadata + +> Updates recipient metadata + + +```php +function updateRecipientMetadata( + $recipientId, + $body, + $idempotencyKey = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| code | ``` Optional ``` | Filter for Invoice's code | -| customerId | ``` Optional ``` | Filter for Invoice's customer id | -| subscriptionId | ``` Optional ``` | Filter for Invoice's subscription id | -| createdSince | ``` Optional ``` | Filter for Invoice's creation date start range | -| createdUntil | ``` Optional ``` | Filter for Invoices creation date end range | -| status | ``` Optional ``` | Filter for Invoice's status | -| dueSince | ``` Optional ``` | Filter for Invoice's due date start range | -| dueUntil | ``` Optional ``` | Filter for Invoice's due date end range | -| customerDocument | ``` Optional ``` | Fillter for invoice's document | +| recipientId | ``` Required ``` | Recipient id | +| body | ``` Required ``` | Metadata | +| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$page = 237; -$size = 237; -$code = 'code'; -$customerId = 'customer_id'; -$subscriptionId = 'subscription_id'; -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); -$status = 'status'; -$dueSince = date("D M d, Y G:i"); -$dueUntil = date("D M d, Y G:i"); -$customerDocument = 'customer_document'; +$recipientId = 'recipient_id'; +$body = new RecipientsMetadataRequest(); +$idempotencyKey = 'idempotency-key'; -$result = $invoices->getInvoices($page, $size, $code, $customerId, $subscriptionId, $createdSince, $createdUntil, $status, $dueSince, $dueUntil, $customerDocument); +$result = $recipients->updateRecipientMetadata($recipientId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".InvoicesController.cancelInvoice") cancelInvoice +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Cancels an invoice + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientTransferSettings") updateRecipientTransferSettings + +> UpdateRecipientTransferSettings ```php -function cancelInvoice( - $invoiceId, +function updateRecipientTransferSettings( + $recipientId, + $body, $idempotencyKey = null) ``` @@ -3565,7 +4795,8 @@ function cancelInvoice( | Parameter | Tags | Description | |-----------|------|-------------| -| invoiceId | ``` Required ``` | Invoice id | +| recipientId | ``` Required ``` | Recipient Identificator | +| body | ``` Required ``` | TODO: Add a parameter description | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3573,100 +4804,121 @@ function cancelInvoice( #### Example Usage ```php -$invoiceId = 'invoice_id'; +$recipientId = 'recipient_id'; +$body = new UpdateTransferSettingsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $invoices->cancelInvoice($invoiceId, $idempotencyKey); +$result = $recipients->updateRecipientTransferSettings($recipientId, $body, $idempotencyKey); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".OrdersController") OrdersController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` OrdersController ``` class can be accessed from the API Client. -```php -$orders = $client->getOrders(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderStatus") updateOrderStatus +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipation") getAnticipation -> TODO: Add a method description +> Gets an anticipation ```php -function updateOrderStatus( - $id, - $request, - $idempotencyKey = null) +function getAnticipation( + $recipientId, + $anticipationId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| id | ``` Required ``` | Order Id | -| request | ``` Required ``` | Update Order Model | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| recipientId | ``` Required ``` | Recipient id | +| anticipationId | ``` Required ``` | Anticipation id | #### Example Usage ```php -$id = 'id'; -$request = new UpdateOrderStatusRequest(); -$idempotencyKey = 'idempotency-key'; +$recipientId = 'recipient_id'; +$anticipationId = 'anticipation_id'; -$result = $orders->updateOrderStatus($id, $request, $idempotencyKey); +$result = $recipients->getAnticipation($recipientId, $anticipationId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.deleteAllOrderItems") deleteAllOrderItems -> TODO: Add a method description +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipients") getRecipients + +> Retrieves paginated recipients information ```php -function deleteAllOrderItems( - $orderId, - $idempotencyKey = null) +function getRecipients( + $page = null, + $size = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | Order Id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | #### Example Usage ```php -$orderId = 'orderId'; -$idempotencyKey = 'idempotency-key'; +$page = 62; +$size = 62; -$result = $orders->deleteAllOrderItems($orderId, $idempotencyKey); +$result = $recipients->getRecipients($page, $size); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderMetadata") updateOrderMetadata -> Updates the metadata from an order + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createRecipient") createRecipient + +> Creates a new recipient ```php -function updateOrderMetadata( - $orderId, - $request, +function createRecipient( + $body, $idempotencyKey = null) ``` @@ -3674,8 +4926,7 @@ function updateOrderMetadata( | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | The order id | -| request | ``` Required ``` | Request for updating the order metadata | +| body | ``` Required ``` | Recipient data | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3683,104 +4934,138 @@ function updateOrderMetadata( #### Example Usage ```php -$orderId = 'order_id'; -$request = new UpdateMetadataRequest(); +$body = new RecipientsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $orders->updateOrderMetadata($orderId, $request, $idempotencyKey); +$result = $recipients->createRecipient($body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrders") getOrders +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets all orders + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getBalance") getBalance + +> Get balance information for a recipient ```php -function getOrders( - $page = null, - $size = null, - $code = null, - $status = null, - $createdSince = null, - $createdUntil = null, - $customerId = null) +function getBalance($recipientId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| code | ``` Optional ``` | Filter for order's code | -| status | ``` Optional ``` | Filter for order's status | -| createdSince | ``` Optional ``` | Filter for order's creation date start range | -| createdUntil | ``` Optional ``` | Filter for order's creation date end range | -| customerId | ``` Optional ``` | Filter for order's customer id | +| recipientId | ``` Required ``` | Recipient id | #### Example Usage ```php -$page = 237; -$size = 237; -$code = 'code'; -$status = 'status'; -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); -$customerId = 'customer_id'; +$recipientId = 'recipient_id'; -$result = $orders->getOrders($page, $size, $code, $status, $createdSince, $createdUntil, $customerId); +$result = $recipients->getBalance($recipientId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.createOrderItem") createOrderItem -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipations") getAnticipations + +> Retrieves a paginated list of anticipations from a recipient ```php -function createOrderItem( - $orderId, - $request, - $idempotencyKey = null) +function getAnticipations( + $recipientId, + $page = null, + $size = null, + $status = null, + $timeframe = null, + $paymentDateSince = null, + $paymentDateUntil = null, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | Order Id | -| request | ``` Required ``` | Order Item Model | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| recipientId | ``` Required ``` | Recipient id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| status | ``` Optional ``` | Filter for anticipation status | +| timeframe | ``` Optional ``` | Filter for anticipation timeframe | +| paymentDateSince | ``` Optional ``` | Filter for start range for anticipation payment date | +| paymentDateUntil | ``` Optional ``` | Filter for end range for anticipation payment date | +| createdSince | ``` Optional ``` | Filter for start range for anticipation creation date | +| createdUntil | ``` Optional ``` | Filter for end range for anticipation creation date | #### Example Usage ```php -$orderId = 'orderId'; -$request = new CreateOrderItemRequest(); -$idempotencyKey = 'idempotency-key'; +$recipientId = 'recipient_id'; +$page = 62; +$size = 62; +$status = 'status'; +$timeframe = 'timeframe'; +$paymentDateSince = date("D M d, Y G:i"); +$paymentDateUntil = date("D M d, Y G:i"); +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); -$result = $orders->createOrderItem($orderId, $request, $idempotencyKey); +$result = $recipients->getAnticipations($recipientId, $page, $size, $status, $timeframe, $paymentDateSince, $paymentDateUntil, $createdSince, $createdUntil); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.deleteOrderItem") deleteOrderItem -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createAnticipation") createAnticipation + +> Creates an anticipation ```php -function deleteOrderItem( - $orderId, - $itemId, +function createAnticipation( + $recipientId, + $body, $idempotencyKey = null) ``` @@ -3788,8 +5073,8 @@ function deleteOrderItem( | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | Order Id | -| itemId | ``` Required ``` | Item Id | +| recipientId | ``` Required ``` | Recipient id | +| body | ``` Required ``` | Anticipation data | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3797,49 +5082,35 @@ function deleteOrderItem( #### Example Usage ```php -$orderId = 'orderId'; -$itemId = 'itemId'; +$recipientId = 'recipient_id'; +$body = new RecipientsAnticipationsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $orders->deleteOrderItem($orderId, $itemId, $idempotencyKey); - -``` - +$result = $recipients->createAnticipation($recipientId, $body, $idempotencyKey); -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrder") getOrder - -> Gets an order - - -```php -function getOrder($orderId) ``` -#### Parameters - -| Parameter | Tags | Description | -|-----------|------|-------------| -| orderId | ``` Required ``` | Order id | - - - -#### Example Usage - -```php -$orderId = 'order_id'; +#### Errors -$result = $orders->getOrder($orderId); +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -``` -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.createOrder") createOrder +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipientDefaultBankAccount") updateRecipientDefaultBankAccount -> Creates a new Order +> Updates the default bank account from a recipient ```php -function createOrder( +function updateRecipientDefaultBankAccount( + $recipientId, $body, $idempotencyKey = null) ``` @@ -3848,7 +5119,8 @@ function createOrder( | Parameter | Tags | Description | |-----------|------|-------------| -| body | ``` Required ``` | Request for creating an order | +| recipientId | ``` Required ``` | Recipient id | +| body | ``` Required ``` | Bank account data | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3856,55 +5128,75 @@ function createOrder( #### Example Usage ```php -$body = new CreateOrderRequest(); +$recipientId = 'recipient_id'; +$body = new RecipientsDefaultBankAccountRequest(); $idempotencyKey = 'idempotency-key'; -$result = $orders->createOrder($body, $idempotencyKey); +$result = $recipients->updateRecipientDefaultBankAccount($recipientId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.getOrderItem") getOrderItem +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipient") getRecipient -> TODO: Add a method description +> Retrieves recipient information ```php -function getOrderItem( - $orderId, - $itemId) +function getRecipient($recipientId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | Order Id | -| itemId | ``` Required ``` | Item Id | +| recipientId | ``` Required ``` | Recipiend id | #### Example Usage ```php -$orderId = 'orderId'; -$itemId = 'itemId'; +$recipientId = 'recipient_id'; -$result = $orders->getOrderItem($orderId, $itemId); +$result = $recipients->getRecipient($recipientId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -### ![Method: ](https://apidocs.io/img/method.png ".OrdersController.updateOrderItem") updateOrderItem -> TODO: Add a method description + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateRecipient") updateRecipient + +> Updates a recipient ```php -function updateOrderItem( - $orderId, - $itemId, - $request, +function updateRecipient( + $recipientId, + $body, $idempotencyKey = null) ``` @@ -3912,9 +5204,8 @@ function updateOrderItem( | Parameter | Tags | Description | |-----------|------|-------------| -| orderId | ``` Required ``` | Order Id | -| itemId | ``` Required ``` | Item Id | -| request | ``` Required ``` | Item Model | +| recipientId | ``` Required ``` | Recipient id | +| body | ``` Required ``` | Recipient data | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -3922,118 +5213,133 @@ function updateOrderItem( #### Example Usage ```php -$orderId = 'orderId'; -$itemId = 'itemId'; -$request = new UpdateOrderItemRequest(); +$recipientId = 'recipient_id'; +$body = new RecipientsRequest1(); $idempotencyKey = 'idempotency-key'; -$result = $orders->updateOrderItem($orderId, $itemId, $request, $idempotencyKey); +$result = $recipients->updateRecipient($recipientId, $body, $idempotencyKey); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".TokensController") TokensController - -### Get singleton instance - -The singleton instance of the ``` TokensController ``` class can be accessed from the API Client. +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -$tokens = $client->getTokens(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".TokensController.createToken") createToken -> *Tags:* ``` Skips Authentication ``` +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getTransfer") getTransfer -> TODO: Add a method description +> Gets a transfer ```php -function createToken( - $publicKey, - $request, - $idempotencyKey = null) +function getTransfer( + $recipientId, + $transferId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| publicKey | ``` Required ``` | Public key | -| request | ``` Required ``` | Request for creating a token | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| recipientId | ``` Required ``` | Recipient id | +| transferId | ``` Required ``` | Transfer id | #### Example Usage ```php -$publicKey = 'public_key'; -$request = new CreateTokenRequest(); -$idempotencyKey = 'idempotency-key'; +$recipientId = 'recipient_id'; +$transferId = 'transfer_id'; -$result = $tokens->createToken($publicKey, $request, $idempotencyKey); +$result = $recipients->getTransfer($recipientId, $transferId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".TokensController.getToken") getToken +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> *Tags:* ``` Skips Authentication ``` -> Gets a token from its id + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getTransfers") getTransfers + +> Gets a paginated list of transfers for the recipient ```php -function getToken( - $id, - $publicKey) +function getTransfers( + $recipientId, + $page = null, + $size = null, + $status = null, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| id | ``` Required ``` | Token id | -| publicKey | ``` Required ``` | Public key | +| recipientId | ``` Required ``` | Recipient id | +| page | ``` Optional ``` | Page number | +| size | ``` Optional ``` | Page size | +| status | ``` Optional ``` | Filter for transfer status | +| createdSince | ``` Optional ``` | Filter for start range of transfer creation date | +| createdUntil | ``` Optional ``` | Filter for end range of transfer creation date | #### Example Usage ```php -$id = 'id'; -$publicKey = 'public_key'; +$recipientId = 'recipient_id'; +$page = 62; +$size = 62; +$status = 'status'; +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); -$result = $tokens->getToken($id, $publicKey); +$result = $recipients->getTransfers($recipientId, $page, $size, $status, $createdSince, $createdUntil); ``` +#### Errors -[Back to List of Controllers](#list_of_controllers) - -## ![Class: ](https://apidocs.io/img/class.png ".PlansController") PlansController - -### Get singleton instance +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -The singleton instance of the ``` PlansController ``` class can be accessed from the API Client. -```php -$plans = $client->getPlans(); -``` -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlanItem") updatePlanItem +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createTransfer") createTransfer -> Updates a plan item +> Creates a transfer for a recipient ```php -function updatePlanItem( - $planId, - $planItemId, +function createTransfer( + $recipientId, $body, $idempotencyKey = null) ``` @@ -4042,9 +5348,8 @@ function updatePlanItem( | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | -| planItemId | ``` Required ``` | Plan item id | -| body | ``` Required ``` | Request for updating the plan item | +| recipientId | ``` Required ``` | Recipient Id | +| body | ``` Required ``` | Transfer data | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -4052,166 +5357,223 @@ function updatePlanItem( #### Example Usage ```php -$planId = 'plan_id'; -$planItemId = 'plan_item_id'; -$body = new UpdatePlanItemRequest(); +$recipientId = 'recipient_id'; +$body = new RecipientsTransfersRequest(); $idempotencyKey = 'idempotency-key'; -$result = $plans->updatePlanItem($planId, $planItemId, $body, $idempotencyKey); +$result = $recipients->createTransfer($recipientId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.createPlanItem") createPlanItem +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Adds a new item to a plan + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getAnticipationLimits") getAnticipationLimits + +> Gets the anticipation limits for a recipient ```php -function createPlanItem( - $planId, - $request, - $idempotencyKey = null) +function getAnticipationLimits( + $recipientId, + $timeframe, + $paymentDate) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | -| request | ``` Required ``` | Request for creating a plan item | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| recipientId | ``` Required ``` | Recipient id | +| timeframe | ``` Required ``` | Timeframe | +| paymentDate | ``` Required ``` | Anticipation payment date | #### Example Usage ```php -$planId = 'plan_id'; -$request = new CreatePlanItemRequest(); -$idempotencyKey = 'idempotency-key'; +$recipientId = 'recipient_id'; +$timeframe = 'timeframe'; +$paymentDate = date("D M d, Y G:i"); -$result = $plans->createPlanItem($planId, $request, $idempotencyKey); +$result = $recipients->getAnticipationLimits($recipientId, $timeframe, $paymentDate); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlans") getPlans +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets all plans + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.createWithdraw") createWithdraw + +> CreateWithdraw ```php -function getPlans( - $page = null, - $size = null, - $name = null, - $status = null, - $billingType = null, - $createdSince = null, - $createdUntil = null) +function createWithdraw( + $recipientId, + $body) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| page | ``` Optional ``` | Page number | -| size | ``` Optional ``` | Page size | -| name | ``` Optional ``` | Filter for Plan's name | -| status | ``` Optional ``` | Filter for Plan's status | -| billingType | ``` Optional ``` | Filter for plan's billing type | -| createdSince | ``` Optional ``` | Filter for plan's creation date start range | -| createdUntil | ``` Optional ``` | Filter for plan's creation date end range | +| recipientId | ``` Required ``` | TODO: Add a parameter description | +| body | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$page = 237; -$size = 237; -$name = 'name'; -$status = 'status'; -$billingType = 'billing_type'; -$createdSince = date("D M d, Y G:i"); -$createdUntil = date("D M d, Y G:i"); +$recipientId = 'recipient_id'; +$body = new CreateWithdrawRequest(); -$result = $plans->getPlans($page, $size, $name, $status, $billingType, $createdSince, $createdUntil); +$result = $recipients->createWithdraw($recipientId, $body); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlan") getPlan +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets a plan + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getWithdrawals") getWithdrawals + +> Gets a paginated list of transfers for the recipient ```php -function getPlan($planId) +function getWithdrawals( + $recipientId, + $page = null, + $size = null, + $status = null, + $createdSince = null, + $createdUntil = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | +| recipientId | ``` Required ``` | TODO: Add a parameter description | +| page | ``` Optional ``` | TODO: Add a parameter description | +| size | ``` Optional ``` | TODO: Add a parameter description | +| status | ``` Optional ``` | TODO: Add a parameter description | +| createdSince | ``` Optional ``` | TODO: Add a parameter description | +| createdUntil | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$planId = 'plan_id'; +$recipientId = 'recipient_id'; +$page = 153; +$size = 153; +$status = 'status'; +$createdSince = date("D M d, Y G:i"); +$createdUntil = date("D M d, Y G:i"); -$result = $plans->getPlan($planId); +$result = $recipients->getWithdrawals($recipientId, $page, $size, $status, $createdSince, $createdUntil); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlan") updatePlan +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates a plan + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getWithdrawById") getWithdrawById + +> GetWithdrawById ```php -function updatePlan( - $planId, - $request, - $idempotencyKey = null) +function getWithdrawById( + $recipientId, + $withdrawalId) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | -| request | ``` Required ``` | Request for updating a plan | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| recipientId | ``` Required ``` | TODO: Add a parameter description | +| withdrawalId | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$planId = 'plan_id'; -$request = new UpdatePlanRequest(); -$idempotencyKey = 'idempotency-key'; +$recipientId = 'recipient_id'; +$withdrawalId = 'withdrawal_id'; -$result = $plans->updatePlan($planId, $request, $idempotencyKey); +$result = $recipients->getWithdrawById($recipientId, $withdrawalId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.updatePlanMetadata") updatePlanMetadata +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Updates the metadata from a plan + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.updateAutomaticAnticipationSettings") updateAutomaticAnticipationSettings + +> Updates recipient metadata ```php -function updatePlanMetadata( - $planId, - $request, +function updateAutomaticAnticipationSettings( + $recipientId, + $body, $idempotencyKey = null) ``` @@ -4219,8 +5581,8 @@ function updatePlanMetadata( | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | The plan id | -| request | ``` Required ``` | Request for updating the plan metadata | +| recipientId | ``` Required ``` | Recipient id | +| body | ``` Required ``` | Metadata | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | @@ -4228,141 +5590,176 @@ function updatePlanMetadata( #### Example Usage ```php -$planId = 'plan_id'; -$request = new UpdateMetadataRequest(); +$recipientId = 'recipient_id'; +$body = new UpdateAutomaticAnticipationSettingsRequest(); $idempotencyKey = 'idempotency-key'; -$result = $plans->updatePlanMetadata($planId, $request, $idempotencyKey); +$result = $recipients->updateAutomaticAnticipationSettings($recipientId, $body, $idempotencyKey); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.createPlan") createPlan +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Creates a new plan + + +### ![Method: ](https://apidocs.io/img/method.png ".RecipientsController.getRecipientByCode") getRecipientByCode + +> Retrieves recipient information ```php -function createPlan( - $body, - $idempotencyKey = null) +function getRecipientByCode($code) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| body | ``` Required ``` | Request for creating a plan | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| code | ``` Required ``` | Recipient code | #### Example Usage ```php -$body = new CreatePlanRequest(); -$idempotencyKey = 'idempotency-key'; +$code = 'code'; -$result = $plans->createPlan($body, $idempotencyKey); +$result = $recipients->getRecipientByCode($code); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.deletePlanItem") deletePlanItem - -> Removes an item from a plan - +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -```php -function deletePlanItem( - $planId, - $planItemId, - $idempotencyKey = null) -``` -#### Parameters -| Parameter | Tags | Description | -|-----------|------|-------------| -| planId | ``` Required ``` | Plan id | -| planItemId | ``` Required ``` | Plan item id | -| idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +[Back to List of Controllers](#list_of_controllers) +## ![Class: ](https://apidocs.io/img/class.png ".TokensController") TokensController +### Get singleton instance -#### Example Usage +The singleton instance of the ``` TokensController ``` class can be accessed from the API Client. ```php -$planId = 'plan_id'; -$planItemId = 'plan_item_id'; -$idempotencyKey = 'idempotency-key'; - -$result = $plans->deletePlanItem($planId, $planItemId, $idempotencyKey); - +$tokens = $client->getTokens(); ``` +### ![Method: ](https://apidocs.io/img/method.png ".TokensController.createToken") createToken -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.deletePlan") deletePlan +> *Tags:* ``` Skips Authentication ``` -> Deletes a plan +> CreateToken ```php -function deletePlan( - $planId, - $idempotencyKey = null) +function createToken( + $publicKey, + $body, + $idempotencyKey = null, + $appId = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | +| publicKey | ``` Required ``` | Public key | +| body | ``` Required ``` | Request for creating a token | | idempotencyKey | ``` Optional ``` | TODO: Add a parameter description | +| appId | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$planId = 'plan_id'; +$publicKey = 'public_key'; +$body = new TokensRequest(); $idempotencyKey = 'idempotency-key'; +$appId = 'appId'; -$result = $plans->deletePlan($planId, $idempotencyKey); +$result = $tokens->createToken($publicKey, $body, $idempotencyKey, $appId); ``` +#### Errors -### ![Method: ](https://apidocs.io/img/method.png ".PlansController.getPlanItem") getPlanItem +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | -> Gets a plan item + + +### ![Method: ](https://apidocs.io/img/method.png ".TokensController.getToken") getToken + +> *Tags:* ``` Skips Authentication ``` + +> Gets a token from its id ```php -function getPlanItem( - $planId, - $planItemId) +function getToken( + $id, + $publicKey, + $appId = null) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| planId | ``` Required ``` | Plan id | -| planItemId | ``` Required ``` | Plan item id | +| id | ``` Required ``` | Token id | +| publicKey | ``` Required ``` | Public key | +| appId | ``` Optional ``` | TODO: Add a parameter description | #### Example Usage ```php -$planId = 'plan_id'; -$planItemId = 'plan_item_id'; +$id = 'id'; +$publicKey = 'public_key'; +$appId = 'appId'; -$result = $plans->getPlanItem($planId, $planItemId); +$result = $tokens->getToken($id, $publicKey, $appId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + [Back to List of Controllers](#list_of_controllers) @@ -4378,7 +5775,7 @@ $transactions = $client->getTransactions(); ### ![Method: ](https://apidocs.io/img/method.png ".TransactionsController.getTransaction") getTransaction -> TODO: Add a method description +> GetTransaction ```php @@ -4402,6 +5799,18 @@ $result = $transactions->getTransaction($transactionId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + [Back to List of Controllers](#list_of_controllers) @@ -4415,36 +5824,48 @@ The singleton instance of the ``` TransfersController ``` class can be accessed $transfers = $client->getTransfers(); ``` -### ![Method: ](https://apidocs.io/img/method.png ".TransfersController.createTransfer") createTransfer +### ![Method: ](https://apidocs.io/img/method.png ".TransfersController.postCreateTransfer") postCreateTransfer -> TODO: Add a method description +> CreateTransfer ```php -function createTransfer($request) +function postCreateTransfer($body) ``` #### Parameters | Parameter | Tags | Description | |-----------|------|-------------| -| request | ``` Required ``` | TODO: Add a parameter description | +| body | ``` Required ``` | TODO: Add a parameter description | #### Example Usage ```php -$request = new CreateTransfer(); +$body = new CreateTransfer(); -$result = $transfers->createTransfer($request); +$result = $transfers->postCreateTransfer($body); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + ### ![Method: ](https://apidocs.io/img/method.png ".TransfersController.getTransferById") getTransferById -> TODO: Add a method description +> GetTransferById ```php @@ -4468,24 +5889,48 @@ $result = $transfers->getTransferById($transferId); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + -### ![Method: ](https://apidocs.io/img/method.png ".TransfersController.getTransfers") getTransfers + +### ![Method: ](https://apidocs.io/img/method.png ".TransfersController.getTransfers1") getTransfers1 > Gets all transfers ```php -function getTransfers() +function getTransfers1() ``` #### Example Usage ```php -$result = $transfers->getTransfers(); +$result = $transfers->getTransfers1(); ``` +#### Errors + +| Error Code | Error Description | +|------------|-------------------| +| 400 | Invalid request | +| 401 | Invalid API key | +| 404 | An informed resource was not found | +| 412 | Business validation error | +| 422 | Contract validation error | +| 500 | Internal server error | + + [Back to List of Controllers](#list_of_controllers) diff --git a/composer.json b/composer.json index d06b2c3..15f6b6e 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "apimatic/jsonmapper": "^1.3.1" }, "require-dev": { - "squizlabs/php_codesniffer": "^2.7" + "squizlabs/php_codesniffer": "^2.7", + "phpunit/phpunit": "4.8.*" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..5734ad4 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,20 @@ + + + + + ./tests + + + \ No newline at end of file diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index 528e4d6..d9d0cca 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -24,7 +24,7 @@ class BaseController * User-agent to be sent with API calls * @var string */ - const USER_AGENT = 'MundiSDK - PHP 2.4.0'; + const USER_AGENT = 'MundiSDK - PHP 2.4.1'; /** * HttpCallBack instance associated with this controller @@ -73,24 +73,6 @@ protected function getJsonMapper() protected function validateResponse(HttpResponse $response, HttpContext $_httpContext) { - if ($response->getStatusCode() == 400) { - throw new Exceptions\ErrorException('Invalid request', $_httpContext); - } - if ($response->getStatusCode() == 401) { - throw new Exceptions\ErrorException('Invalid API key', $_httpContext); - } - if ($response->getStatusCode() == 404) { - throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); - } - if ($response->getStatusCode() == 412) { - throw new Exceptions\ErrorException('Business validation error', $_httpContext); - } - if ($response->getStatusCode() == 422) { - throw new Exceptions\ErrorException('Contract validation error', $_httpContext); - } - if ($response->getStatusCode() == 500) { - throw new Exceptions\ErrorException('Internal server error', $_httpContext); - } if (($response->getStatusCode() < 200) || ($response->getStatusCode() > 208)) { //[200,208] = HTTP OK throw new APIException('HTTP Response Not OK', $_httpContext); } diff --git a/src/Controllers/ChargesController.php b/src/Controllers/ChargesController.php index 4cdb960..d01d8a3 100644 --- a/src/Controllers/ChargesController.php +++ b/src/Controllers/ChargesController.php @@ -90,27 +90,142 @@ public function getCharge( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesResponse'); } /** - * @todo Add general description for this endpoint + * Cancel a charge + * + * @param string $chargeId Charge id + * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\ChargesRequest $body (optional) Request for cancelling a charge + * @return mixed response from the API call + * @throws APIException Thrown if API call fails + */ + public function cancelCharge( + $chargeId, + $idempotencyKey = null, + $body = null + ) { + + //prepare query string for API call + $_queryBuilder = '/charges/{charge_id}'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'charge_id' => $chargeId, + )); + + //validate and preprocess url + $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); + + //prepare headers + $_headers = array ( + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey + ); + + //json encode body + $_bodyJson = Request\Body::Json($body); + + //set HTTP basic auth parameters + Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + + //call on-before Http callback + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + //and invoke the API call request to fetch the response + $response = Request::delete($_queryUrl, $_headers, $_bodyJson); + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesResponse'); + } + + /** + * ConfirmPayment * * @param string $chargeId TODO: type description here - * @param Models\CreateConfirmPaymentRequest $request (optional) Request for confirm payment * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\CreateConfirmPaymentRequest $body (optional) Request for confirm payment * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function confirmPayment( $chargeId, - $request = null, - $idempotencyKey = null + $idempotencyKey = null, + $body = null ) { //prepare query string for API call @@ -128,12 +243,12 @@ public function confirmPayment( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -155,26 +270,51 @@ public function confirmPayment( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesConfirmPaymentResponse'); } /** * Updates the card from a charge * - * @param string $chargeId Charge id - * @param Models\UpdateChargeCardRequest $request Request for updating a charge's card - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $chargeId Charge id + * @param Models\ChargesCardRequest $body Request for updating a charge's card + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateChargeCard( $chargeId, - $request, + $body, $idempotencyKey = null ) { @@ -193,12 +333,12 @@ public function updateChargeCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -220,12 +360,37 @@ public function updateChargeCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesCardResponse'); } /** @@ -300,69 +465,29 @@ public function getCharges( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListChargesResponse'); - } - - /** - * Cancel a charge - * - * @param string $chargeId Charge id - * @param Models\CreateCancelChargeRequest $request (optional) Request for cancelling a charge - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function cancelCharge( - $chargeId, - $request = null, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/charges/{charge_id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'charge_id' => $chargeId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); } - //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers, $_bodyJson); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); } //handle errors defined at the API level @@ -370,7 +495,7 @@ public function cancelCharge( $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesResponse2'); } /** @@ -424,27 +549,52 @@ public function retryCharge( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesRetryResponse'); } /** * Updates a charge's payment method * - * @param string $chargeId Charge id - * @param Models\UpdateChargePaymentMethodRequest $request Request for updating the payment method from a - * charge - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $chargeId Charge id + * @param Models\ChargesPaymentMethodRequest $body Request for updating the payment method from a + * charge + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateChargePaymentMethod( $chargeId, - $request, + $body, $idempotencyKey = null ) { @@ -463,12 +613,12 @@ public function updateChargePaymentMethod( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -490,26 +640,51 @@ public function updateChargePaymentMethod( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesPaymentMethodResponse'); } /** * Updates the metadata from a charge * - * @param string $chargeId The charge id - * @param Models\UpdateMetadataRequest $request Request for updating the charge metadata - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $chargeId The charge id + * @param Models\ChargesMetadataRequest $body Request for updating the charge metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateChargeMetadata( $chargeId, - $request, + $body, $idempotencyKey = null ) { @@ -528,12 +703,12 @@ public function updateChargeMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -555,27 +730,52 @@ public function updateChargeMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesMetadataResponse'); } /** * Captures a charge * - * @param string $chargeId Charge id - * @param Models\CreateCaptureChargeRequest $request (optional) Request for capturing a charge - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $chargeId Charge id + * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\ChargesCaptureRequest $body (optional) Request for capturing a charge * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function captureCharge( $chargeId, - $request = null, - $idempotencyKey = null + $idempotencyKey = null, + $body = null ) { //prepare query string for API call @@ -593,12 +793,12 @@ public function captureCharge( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -620,26 +820,51 @@ public function captureCharge( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesCaptureResponse'); } /** * Updates the due date from a charge * - * @param string $chargeId Charge Id - * @param Models\UpdateChargeDueDateRequest $request Request for updating the due date - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $chargeId Charge Id + * @param Models\ChargesDueDateRequest $body Request for updating the due date + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateChargeDueDate( $chargeId, - $request, + $body, $idempotencyKey = null ) { @@ -658,12 +883,12 @@ public function updateChargeDueDate( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -685,24 +910,49 @@ public function updateChargeDueDate( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesDueDateResponse'); } /** * Creates a new charge * - * @param Models\CreateChargeRequest $request Request for creating a charge - * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\ChargesRequest1 $body Request for creating a charge + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createCharge( - $request, + $body, $idempotencyKey = null ) { @@ -716,12 +966,12 @@ public function createCharge( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -743,16 +993,41 @@ public function createCharge( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetChargeResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesResponse'); } /** - * @todo Add general description for this endpoint + * GetChargeTransactions * * @param string $chargeId Charge Id * @param integer $page (optional) Page number @@ -809,16 +1084,41 @@ public function getChargeTransactions( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListChargeTransactionsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ChargesTransactionsResponse'); } /** - * @todo Add general description for this endpoint + * GetChargesSummary * * @param string $status TODO: type description here * @param DateTime $createdSince (optional) TODO: type description here @@ -871,6 +1171,31 @@ public function getChargesSummary( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); diff --git a/src/Controllers/CustomersController.php b/src/Controllers/CustomersController.php index 5f1cf98..55db97e 100644 --- a/src/Controllers/CustomersController.php +++ b/src/Controllers/CustomersController.php @@ -44,15 +44,15 @@ public static function getInstance() /** * Creates a access token for a customer * - * @param string $customerId Customer Id - * @param Models\CreateAccessTokenRequest $request Request for creating a access token - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer Id + * @param Models\CustomersAccessTokensRequest $body Request for creating a access token + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createAccessToken( $customerId, - $request, + $body, $idempotencyKey = null ) { @@ -71,12 +71,12 @@ public function createAccessToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -98,62 +98,88 @@ public function createAccessToken( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAccessTokenResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAccessTokensResponse'); } /** - * Updates a customer + * Get all access tokens from a customer * - * @param string $customerId Customer id - * @param Models\UpdateCustomerRequest $request Request for updating a customer - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer Id + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateCustomer( + public function getAccessTokens( $customerId, - $request, - $idempotencyKey = null + $page = null, + $size = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}'; + $_queryBuilder = '/customers/{customer_id}/access-tokens'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, + 'customer_id' => $customerId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -163,31 +189,60 @@ public function updateCustomer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCustomerResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAccessTokensResponse1'); } /** - * Delete a Customer's access tokens + * Updates a customer * - * @param string $customerId Customer Id + * @param string $customerId Customer id + * @param Models\CustomersRequest $body Request for updating a customer + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteAccessTokens( - $customerId + public function updateCustomer( + $customerId, + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/access-tokens/'; + $_queryBuilder = '/customers/{customer_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, + 'customer_id' => $customerId, )); //validate and preprocess url @@ -196,20 +251,25 @@ public function deleteAccessTokens( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -219,12 +279,37 @@ public function deleteAccessTokens( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListAccessTokensResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersResponse'); } /** @@ -275,43 +360,58 @@ public function getCustomer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCustomerResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersResponse'); } /** - * Gets all adressess from a customer + * Delete a Customer's access tokens * - * @param string $customerId Customer id - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size + * @param string $customerId Customer Id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getAddresses( - $customerId, - $page = null, - $size = null + public function deleteAccessTokens( + $customerId ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/addresses'; + $_queryBuilder = '/customers/{customer_id}/access-tokens/'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'customer_id' => $customerId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -341,36 +441,68 @@ public function getAddresses( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListAddressesResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAccessTokensResponse1'); } /** - * Get a Customer's access token + * Gets all adressess from a customer * - * @param string $customerId Customer Id - * @param string $tokenId Token Id + * @param string $customerId Customer id + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getAccessToken( + public function getAddresses( $customerId, - $tokenId + $page = null, + $size = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/access-tokens/{token_id}'; + $_queryBuilder = '/customers/{customer_id}/addresses'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'customer_id' => $customerId, - 'token_id' => $tokenId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -400,34 +532,60 @@ public function getAccessToken( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAccessTokenResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAddressesResponse'); } /** - * Get a customer's address + * Creates a new address for a customer * - * @param string $customerId Customer id - * @param string $addressId Address Id + * @param string $customerId Customer Id + * @param Models\CustomersAddressesRequest $body Request for creating an address + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getAddress( + public function createAddress( $customerId, - $addressId + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/addresses/{address_id}'; + $_queryBuilder = '/customers/{customer_id}/addresses'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, - 'address_id' => $addressId, + 'customer_id' => $customerId, )); //validate and preprocess url @@ -436,20 +594,25 @@ public function getAddress( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -459,35 +622,59 @@ public function getAddress( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAddressResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAddressesResponse1'); } /** - * Creates a new card for a customer + * Get a Customer's access token * - * @param string $customerId Customer id - * @param Models\CreateCardRequest $request Request for creating a card - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer Id + * @param string $tokenId Token Id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createCard( + public function getAccessToken( $customerId, - $request, - $idempotencyKey = null + $tokenId ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/cards'; + $_queryBuilder = '/customers/{customer_id}/access-tokens/{token_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, + 'customer_id' => $customerId, + 'token_id' => $tokenId, )); //validate and preprocess url @@ -496,25 +683,20 @@ public function createCard( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -524,36 +706,61 @@ public function createCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCardResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAccessTokensResponse'); } /** - * Renew a card + * Delete a customer's access token * - * @param string $customerId Customer id - * @param string $cardId Card Id + * @param string $customerId Customer Id + * @param string $tokenId Token Id * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function renewCard( + public function deleteAccessToken( $customerId, - $cardId, + $tokenId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/cards/{card_id}/renew'; + $_queryBuilder = '/customers/{customer_id}/access-tokens/{token_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'customer_id' => $customerId, - 'card_id' => $cardId, + 'token_id' => $tokenId, )); //validate and preprocess url @@ -570,13 +777,13 @@ public function renewCard( Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -586,29 +793,60 @@ public function renewCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCardResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAccessTokensResponse'); } /** - * Creates a new customer + * Get a customer's address * - * @param Models\CreateCustomerRequest $request Request for creating a customer - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer id + * @param string $addressId Address Id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createCustomer( - $request, - $idempotencyKey = null + public function getAddress( + $customerId, + $addressId ) { //prepare query string for API call - $_queryBuilder = '/customers'; + $_queryBuilder = '/customers/{customer_id}/addresses/{address_id}'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'customer_id' => $customerId, + 'address_id' => $addressId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -616,25 +854,20 @@ public function createCustomer( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -644,28 +877,53 @@ public function createCustomer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCustomerResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAddressesResponse1'); } /** * Updates an address * - * @param string $customerId Customer Id - * @param string $addressId Address Id - * @param Models\UpdateAddressRequest $request Request for updating an address - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer Id + * @param string $addressId Address Id + * @param Models\CustomersAddressesRequest1 $body Request for updating an address + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateAddress( $customerId, $addressId, - $request, + $body, $idempotencyKey = null ) { @@ -685,12 +943,12 @@ public function updateAddress( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -712,63 +970,84 @@ public function updateAddress( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAddressResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAddressesResponse1'); } /** - * Get all access tokens from a customer + * Delete a Customer's address * - * @param string $customerId Customer Id - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size + * @param string $customerId Customer Id + * @param string $addressId Address Id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getAccessTokens( + public function deleteAddress( $customerId, - $page = null, - $size = null + $addressId, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/access-tokens'; + $_queryBuilder = '/customers/{customer_id}/addresses/{address_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, + 'customer_id' => $customerId, + 'address_id' => $addressId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'idempotency-key' => $idempotencyKey ); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -778,31 +1057,56 @@ public function getAccessTokens( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListAccessTokensResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersAddressesResponse1'); } /** - * Updates the metadata a customer + * Creates a new card for a customer * - * @param string $customerId The customer id - * @param Models\UpdateMetadataRequest $request Request for updating the customer metadata + * @param string $customerId Customer id + * @param Models\CustomersCardsRequest $body Request for creating a card * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateCustomerMetadata( + public function createCard( $customerId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/Customers/{customer_id}/metadata'; + $_queryBuilder = '/customers/{customer_id}/cards'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -816,24 +1120,24 @@ public function updateCustomerMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -843,59 +1147,88 @@ public function updateCustomerMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCustomerResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsResponse'); } /** - * Delete a Customer's address + * Get all cards from a customer * - * @param string $customerId Customer Id - * @param string $addressId Address Id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer Id + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteAddress( + public function getCards( $customerId, - $addressId, - $idempotencyKey = null + $page = null, + $size = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/addresses/{address_id}'; + $_queryBuilder = '/customers/{customer_id}/cards'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, - 'address_id' => $addressId, + 'customer_id' => $customerId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -905,33 +1238,56 @@ public function deleteAddress( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAddressResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsResponse1'); } /** - * Updates a card + * Renew a card * - * @param string $customerId Customer Id - * @param string $cardId Card id - * @param Models\UpdateCardRequest $request Request for updating a card - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $customerId Customer id + * @param string $cardId Card Id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateCard( + public function renewCard( $customerId, $cardId, - $request, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/cards/{card_id}'; + $_queryBuilder = '/customers/{customer_id}/cards/{card_id}/renew'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -946,24 +1302,20 @@ public function updateCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -973,37 +1325,54 @@ public function updateCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCardResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsRenewResponse'); } /** - * Delete a customer's access token + * Creates a new customer * - * @param string $customerId Customer Id - * @param string $tokenId Token Id - * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\CustomersRequest1 $body Request for creating a customer + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteAccessToken( - $customerId, - $tokenId, + public function createCustomer( + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/access-tokens/{token_id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, - 'token_id' => $tokenId, - )); + $_queryBuilder = '/customers'; //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -1012,20 +1381,24 @@ public function deleteAccessToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1035,36 +1408,72 @@ public function deleteAccessToken( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAccessTokenResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersResponse'); } /** - * Creates a new address for a customer + * Get all Customers * - * @param string $customerId Customer Id - * @param Models\CreateAddressRequest $request Request for creating an address - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $name (optional) Name of the Customer + * @param string $document (optional) Document of the Customer + * @param integer $page (optional) Current page the the search + * @param integer $size (optional) Quantity pages of the search + * @param string $email (optional) Customer's email + * @param string $code (optional) Customer's code * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createAddress( - $customerId, - $request, - $idempotencyKey = null + public function getCustomers( + $name = null, + $document = null, + $page = 1, + $size = 10, + $email = null, + $code = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/addresses'; + $_queryBuilder = '/customers'; //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, - )); + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'name' => $name, + 'document' => $document, + 'page' => (null != $page) ? $page : 1, + 'size' => (null != $size) ? $size : 10, + 'email' => $email, + 'Code' => $code, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -1072,25 +1481,20 @@ public function createAddress( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1100,34 +1504,60 @@ public function createAddress( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAddressResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersResponse3'); } /** - * Get a customer's card + * Updates the metadata a customer * - * @param string $customerId Customer id - * @param string $cardId Card id + * @param string $customerId The customer id + * @param Models\CustomersMetadataRequest $body Request for updating the customer metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getCard( + public function updateCustomerMetadata( $customerId, - $cardId + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/cards/{card_id}'; + $_queryBuilder = '/Customers/{customer_id}/metadata'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, - 'card_id' => $cardId, + 'customer_id' => $customerId, )); //validate and preprocess url @@ -1136,20 +1566,25 @@ public function getCard( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1159,63 +1594,90 @@ public function getCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCardResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersMetadataResponse'); } /** - * Get all cards from a customer + * Updates a card * - * @param string $customerId Customer Id - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size + * @param string $customerId Customer Id + * @param string $cardId Card id + * @param Models\CustomersCardsRequest1 $body Request for updating a card + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getCards( + public function updateCard( $customerId, - $page = null, - $size = null + $cardId, + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/customers/{customer_id}/cards'; + $_queryBuilder = '/customers/{customer_id}/cards/{card_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'customer_id' => $customerId, + 'customer_id' => $customerId, + 'card_id' => $cardId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1225,12 +1687,37 @@ public function getCards( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListCardsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsResponse'); } /** @@ -1287,47 +1774,60 @@ public function deleteCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetCardResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsResponse'); } /** - * Get all Customers + * Get a customer's card * - * @param string $name (optional) Name of the Customer - * @param string $document (optional) Document of the Customer - * @param integer $page (optional) Current page the the search - * @param integer $size (optional) Quantity pages of the search - * @param string $email (optional) Customer's email - * @param string $code (optional) Customer's code + * @param string $customerId Customer id + * @param string $cardId Card id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getCustomers( - $name = null, - $document = null, - $page = 1, - $size = 10, - $email = null, - $code = null + public function getCard( + $customerId, + $cardId ) { //prepare query string for API call - $_queryBuilder = '/customers'; + $_queryBuilder = '/customers/{customer_id}/cards/{card_id}'; //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'name' => $name, - 'document' => $document, - 'page' => (null != $page) ? $page : 1, - 'size' => (null != $size) ? $size : 10, - 'email' => $email, - 'Code' => $code, - )); + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'customer_id' => $customerId, + 'card_id' => $cardId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -1358,11 +1858,36 @@ public function getCustomers( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListCustomersResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\CustomersCardsResponse'); } } diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index ae892c0..e938a95 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -45,18 +45,18 @@ public static function getInstance() /** * Create an Invoice * - * @param string $subscriptionId Subscription Id - * @param string $cycleId Cycle Id - * @param Models\CreateInvoiceRequest $request (optional) TODO: type description here - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription Id + * @param string $cycleId Cycle Id + * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\SubscriptionsCyclesPayRequest $body (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createInvoice( $subscriptionId, $cycleId, - $request = null, - $idempotencyKey = null + $idempotencyKey = null, + $body = null ) { //prepare query string for API call @@ -75,12 +75,12 @@ public function createInvoice( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -102,16 +102,41 @@ public function createInvoice( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsCyclesPayResponse'); } /** - * @todo Add general description for this endpoint + * GetPartialInvoice * * @param string $subscriptionId Subscription Id * @return mixed response from the API call @@ -158,26 +183,51 @@ public function getPartialInvoice( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsPartialInvoiceResponse'); } /** * Updates the status from an invoice * - * @param string $invoiceId Invoice Id - * @param Models\UpdateInvoiceStatusRequest $request Request for updating an invoice's status - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $invoiceId Invoice Id + * @param Models\UpdateCurrentCycleStatusRequest $body Request for updating an invoice's status + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateInvoiceStatus( $invoiceId, - $request, + $body, $idempotencyKey = null ) { @@ -196,12 +246,12 @@ public function updateInvoiceStatus( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -223,12 +273,37 @@ public function updateInvoiceStatus( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\InvoicesStatusResponse'); } /** @@ -279,26 +354,135 @@ public function getInvoice( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\InvoicesResponse'); + } + + /** + * Cancels an invoice + * + * @param string $invoiceId Invoice id + * @param string $idempotencyKey (optional) TODO: type description here + * @return mixed response from the API call + * @throws APIException Thrown if API call fails + */ + public function cancelInvoice( + $invoiceId, + $idempotencyKey = null + ) { + + //prepare query string for API call + $_queryBuilder = '/invoices/{invoice_id}'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'invoice_id' => $invoiceId, + )); + + //validate and preprocess url + $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); + + //prepare headers + $_headers = array ( + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'idempotency-key' => $idempotencyKey + ); + + //set HTTP basic auth parameters + Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + + //call on-before Http callback + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + //and invoke the API call request to fetch the response + $response = Request::delete($_queryUrl, $_headers); + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\InvoicesResponse'); } /** * Updates the metadata from an invoice * - * @param string $invoiceId The invoice id - * @param Models\UpdateMetadataRequest $request Request for updating the invoice metadata - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $invoiceId The invoice id + * @param Models\InvoicesMetadataRequest $body Request for updating the invoice metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateInvoiceMetadata( $invoiceId, - $request, + $body, $idempotencyKey = null ) { @@ -317,12 +501,12 @@ public function updateInvoiceMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -344,12 +528,37 @@ public function updateInvoiceMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\InvoicesMetadataResponse'); } /** @@ -430,63 +639,29 @@ public function getInvoices( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListInvoicesResponse'); - } - - /** - * Cancels an invoice - * - * @param string $invoiceId Invoice id - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function cancelInvoice( - $invoiceId, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/invoices/{invoice_id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'invoice_id' => $invoiceId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'idempotency-key' => $idempotencyKey - ); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); } - //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); } //handle errors defined at the API level @@ -494,6 +669,6 @@ public function cancelInvoice( $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetInvoiceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\InvoicesResponse2'); } } diff --git a/src/Controllers/OrdersController.php b/src/Controllers/OrdersController.php index 67b35b6..a7420aa 100644 --- a/src/Controllers/OrdersController.php +++ b/src/Controllers/OrdersController.php @@ -43,17 +43,17 @@ public static function getInstance() } /** - * @todo Add general description for this endpoint + * UpdateOrderStatus * * @param string $id Order Id - * @param Models\UpdateOrderStatusRequest $request Update Order Model + * @param Models\UpdateOrderStatusRequest $body Update Order Model * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateOrderStatus( $id, - $request, + $body, $idempotencyKey = null ) { @@ -72,12 +72,12 @@ public function updateOrderStatus( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -99,16 +99,41 @@ public function updateOrderStatus( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersClosedResponse'); } /** - * @todo Add general description for this endpoint + * DeleteAllOrderItems * * @param string $orderId Order Id * @param string $idempotencyKey (optional) TODO: type description here @@ -158,26 +183,141 @@ public function deleteAllOrderItems( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersItemsResponse'); + } + + /** + * CreateOrderItem + * + * @param string $orderId Order Id + * @param Models\OrdersItemsRequest $body Order Item Model + * @param string $idempotencyKey (optional) TODO: type description here + * @return mixed response from the API call + * @throws APIException Thrown if API call fails + */ + public function createOrderItem( + $orderId, + $body, + $idempotencyKey = null + ) { + + //prepare query string for API call + $_queryBuilder = '/orders/{orderId}/items'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'orderId' => $orderId, + )); + + //validate and preprocess url + $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); + + //prepare headers + $_headers = array ( + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey + ); + + //json encode body + $_bodyJson = Request\Body::Json($body); + + //set HTTP basic auth parameters + Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + + //call on-before Http callback + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + //and invoke the API call request to fetch the response + $response = Request::post($_queryUrl, $_headers, $_bodyJson); + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersItemsResponse1'); } /** * Updates the metadata from an order * * @param string $orderId The order id - * @param Models\UpdateMetadataRequest $request Request for updating the order metadata + * @param Models\OrdersMetadataRequest $body Request for updating the order metadata * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateOrderMetadata( $orderId, - $request, + $body, $idempotencyKey = null ) { @@ -196,12 +336,12 @@ public function updateOrderMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -223,12 +363,37 @@ public function updateOrderMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersMetadataResponse'); } /** @@ -297,36 +462,54 @@ public function getOrders( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersResponse'); } /** - * @todo Add general description for this endpoint + * Creates a new Order * - * @param string $orderId Order Id - * @param Models\CreateOrderItemRequest $request Order Item Model - * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\OrdersRequest $body Request for creating an order + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createOrderItem( - $orderId, - $request, + public function createOrder( + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/orders/{orderId}/items'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'orderId' => $orderId, - )); + $_queryBuilder = '/orders'; //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -335,12 +518,12 @@ public function createOrderItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -362,16 +545,41 @@ public function createOrderItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersResponse1'); } /** - * @todo Add general description for this endpoint + * DeleteOrderItem * * @param string $orderId Order Id * @param string $itemId Item Id @@ -424,31 +632,59 @@ public function deleteOrderItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersItemsResponse1'); } /** - * Gets an order + * GetOrderItem * - * @param string $orderId Order id + * @param string $orderId Order Id + * @param string $itemId Item Id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getOrder( - $orderId + public function getOrderItem( + $orderId, + $itemId ) { //prepare query string for API call - $_queryBuilder = '/orders/{order_id}'; + $_queryBuilder = '/orders/{orderId}/items/{itemId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'order_id' => $orderId, + 'orderId' => $orderId, + 'itemId' => $itemId, )); //validate and preprocess url @@ -480,29 +716,64 @@ public function getOrder( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersItemsResponse1'); } /** - * Creates a new Order + * UpdateOrderItem * - * @param Models\CreateOrderRequest $body Request for creating an order - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $orderId Order Id + * @param string $itemId Item Id + * @param Models\OrdersItemsRequest1 $body Item Model + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createOrder( + public function updateOrderItem( + $orderId, + $itemId, $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/orders'; + $_queryBuilder = '/orders/{orderId}/items/{itemId}'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'orderId' => $orderId, + 'itemId' => $itemId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -511,7 +782,7 @@ public function createOrder( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -522,13 +793,13 @@ public function createOrder( Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -538,34 +809,56 @@ public function createOrder( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersItemsResponse1'); } /** - * @todo Add general description for this endpoint + * Gets an order * - * @param string $orderId Order Id - * @param string $itemId Item Id + * @param string $orderId Order id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getOrderItem( - $orderId, - $itemId + public function getOrder( + $orderId ) { //prepare query string for API call - $_queryBuilder = '/orders/{orderId}/items/{itemId}'; + $_queryBuilder = '/orders/{order_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'orderId' => $orderId, - 'itemId' => $itemId, + 'order_id' => $orderId, )); //validate and preprocess url @@ -597,72 +890,29 @@ public function getOrderItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderItemResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param string $orderId Order Id - * @param string $itemId Item Id - * @param Models\UpdateOrderItemRequest $request Item Model - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function updateOrderItem( - $orderId, - $itemId, - $request, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/orders/{orderId}/items/{itemId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'orderId' => $orderId, - 'itemId' => $itemId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); } - //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); } //handle errors defined at the API level @@ -670,6 +920,6 @@ public function updateOrderItem( $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetOrderItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\OrdersResponse1'); } } diff --git a/src/Controllers/PlansController.php b/src/Controllers/PlansController.php index 095fa6e..aa208b7 100644 --- a/src/Controllers/PlansController.php +++ b/src/Controllers/PlansController.php @@ -45,10 +45,10 @@ public static function getInstance() /** * Updates a plan item * - * @param string $planId Plan id - * @param string $planItemId Plan item id - * @param Models\UpdatePlanItemRequest $body Request for updating the plan item - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $planId Plan id + * @param string $planItemId Plan item id + * @param Models\PlansItemsRequest $body Request for updating the plan item + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ @@ -75,7 +75,7 @@ public function updatePlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -102,35 +102,61 @@ public function updatePlanItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansItemsResponse'); } /** - * Adds a new item to a plan + * Removes an item from a plan * - * @param string $planId Plan id - * @param Models\CreatePlanItemRequest $request Request for creating a plan item - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $planId Plan id + * @param string $planItemId Plan item id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createPlanItem( + public function deletePlanItem( $planId, - $request, + $planItemId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/plans/{plan_id}/items'; + $_queryBuilder = '/plans/{plan_id}/items/{plan_item_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'plan_id' => $planId, + 'plan_item_id' => $planItemId, )); //validate and preprocess url @@ -140,24 +166,20 @@ public function createPlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -167,50 +189,60 @@ public function createPlanItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansItemsResponse'); } /** - * Gets all plans + * Gets a plan item * - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size - * @param string $name (optional) Filter for Plan's name - * @param string $status (optional) Filter for Plan's status - * @param string $billingType (optional) Filter for plan's billing type - * @param DateTime $createdSince (optional) Filter for plan's creation date start range - * @param DateTime $createdUntil (optional) Filter for plan's creation date end range + * @param string $planId Plan id + * @param string $planItemId Plan item id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getPlans( - $page = null, - $size = null, - $name = null, - $status = null, - $billingType = null, - $createdSince = null, - $createdUntil = null + public function getPlanItem( + $planId, + $planItemId ) { //prepare query string for API call - $_queryBuilder = '/plans'; + $_queryBuilder = '/plans/{plan_id}/items/{plan_item_id}'; //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - 'name' => $name, - 'status' => $status, - 'billing_type' => $billingType, - 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), - 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), - )); + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'plan_id' => $planId, + 'plan_item_id' => $planItemId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -241,31 +273,60 @@ public function getPlans( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListPlansResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansItemsResponse'); } /** - * Gets a plan + * Adds a new item to a plan * - * @param string $planId Plan id + * @param string $planId Plan id + * @param Models\PlansItemsRequest1 $body Request for creating a plan item + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getPlan( - $planId + public function createPlanItem( + $planId, + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/plans/{plan_id}'; + $_queryBuilder = '/plans/{plan_id}/items'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'plan_id' => $planId, + 'plan_id' => $planId, )); //validate and preprocess url @@ -274,20 +335,25 @@ public function getPlan( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -297,36 +363,75 @@ public function getPlan( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansItemsResponse'); } /** - * Updates a plan + * Gets all plans * - * @param string $planId Plan id - * @param Models\UpdatePlanRequest $request Request for updating a plan - * @param string $idempotencyKey (optional) TODO: type description here + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size + * @param string $name (optional) Filter for Plan's name + * @param string $status (optional) Filter for Plan's status + * @param string $billingType (optional) Filter for plan's billing type + * @param DateTime $createdSince (optional) Filter for plan's creation date start range + * @param DateTime $createdUntil (optional) Filter for plan's creation date end range * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updatePlan( - $planId, - $request, - $idempotencyKey = null + public function getPlans( + $page = null, + $size = null, + $name = null, + $status = null, + $billingType = null, + $createdSince = null, + $createdUntil = null ) { //prepare query string for API call - $_queryBuilder = '/plans/{plan_id}'; + $_queryBuilder = '/plans'; //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'plan_id' => $planId, - )); + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + 'name' => $name, + 'status' => $status, + 'billing_type' => $billingType, + 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), + 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -334,25 +439,20 @@ public function updatePlan( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -362,36 +462,54 @@ public function updatePlan( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansResponse'); } /** - * Updates the metadata from a plan + * Creates a new plan * - * @param string $planId The plan id - * @param Models\UpdateMetadataRequest $request Request for updating the plan metadata - * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\PlansRequest $body Request for creating a plan + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updatePlanMetadata( - $planId, - $request, + public function createPlan( + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/Plans/{plan_id}/metadata'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'plan_id' => $planId, - )); + $_queryBuilder = '/plans'; //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -400,24 +518,24 @@ public function updatePlanMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -427,29 +545,57 @@ public function updatePlanMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansResponse1'); } /** - * Creates a new plan + * Gets a plan * - * @param Models\CreatePlanRequest $body Request for creating a plan - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $planId Plan id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createPlan( - $body, - $idempotencyKey = null + public function getPlan( + $planId ) { //prepare query string for API call - $_queryBuilder = '/plans'; + $_queryBuilder = '/plans/{plan_id}'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'plan_id' => $planId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -457,25 +603,20 @@ public function createPlan( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($body); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -485,36 +626,60 @@ public function createPlan( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansResponse1'); } /** - * Removes an item from a plan + * Updates a plan * - * @param string $planId Plan id - * @param string $planItemId Plan item id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $planId Plan id + * @param Models\PlansRequest1 $body Request for updating a plan + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deletePlanItem( + public function updatePlan( $planId, - $planItemId, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/plans/{plan_id}/items/{plan_item_id}'; + $_queryBuilder = '/plans/{plan_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'plan_id' => $planId, - 'plan_item_id' => $planItemId, )); //validate and preprocess url @@ -524,20 +689,24 @@ public function deletePlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -547,12 +716,37 @@ public function deletePlanItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansResponse1'); } /** @@ -606,34 +800,60 @@ public function deletePlan( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansResponse1'); } /** - * Gets a plan item + * Updates the metadata from a plan * - * @param string $planId Plan id - * @param string $planItemId Plan item id + * @param string $planId The plan id + * @param Models\PlansMetadataRequest $body Request for updating the plan metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getPlanItem( + public function updatePlanMetadata( $planId, - $planItemId + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/plans/{plan_id}/items/{plan_item_id}'; + $_queryBuilder = '/Plans/{plan_id}/metadata'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'plan_id' => $planId, - 'plan_item_id' => $planItemId, + 'plan_id' => $planId, )); //validate and preprocess url @@ -642,20 +862,25 @@ public function getPlanItem( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -665,11 +890,36 @@ public function getPlanItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPlanItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\PlansMetadataResponse'); } } diff --git a/src/Controllers/RecipientsController.php b/src/Controllers/RecipientsController.php index ef32869..81fd667 100644 --- a/src/Controllers/RecipientsController.php +++ b/src/Controllers/RecipientsController.php @@ -45,15 +45,15 @@ public static function getInstance() /** * Updates recipient metadata * - * @param string $recipientId Recipient id - * @param Models\UpdateMetadataRequest $request Metadata - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $recipientId Recipient id + * @param Models\RecipientsMetadataRequest $body Metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateRecipientMetadata( $recipientId, - $request, + $body, $idempotencyKey = null ) { @@ -72,12 +72,12 @@ public function updateRecipientMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -99,26 +99,51 @@ public function updateRecipientMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsMetadataResponse'); } /** - * @todo Add general description for this endpoint + * UpdateRecipientTransferSettings * * @param string $recipientId Recipient Identificator - * @param Models\UpdateTransferSettingsRequest $request TODO: type description here + * @param Models\UpdateTransferSettingsRequest $body TODO: type description here * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateRecipientTransferSettings( $recipientId, - $request, + $body, $idempotencyKey = null ) { @@ -137,12 +162,12 @@ public function updateRecipientTransferSettings( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -164,12 +189,37 @@ public function updateRecipientTransferSettings( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsTransferSettingsResponse'); } /** @@ -223,12 +273,37 @@ public function getAnticipation( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAnticipationResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsAnticipationsResponse'); } /** @@ -282,12 +357,120 @@ public function getRecipients( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsResponse'); + } + + /** + * Creates a new recipient + * + * @param Models\RecipientsRequest $body Recipient data + * @param string $idempotencyKey (optional) TODO: type description here + * @return mixed response from the API call + * @throws APIException Thrown if API call fails + */ + public function createRecipient( + $body, + $idempotencyKey = null + ) { + + //prepare query string for API call + $_queryBuilder = '/recipients'; + + //validate and preprocess url + $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); + + //prepare headers + $_headers = array ( + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey + ); + + //json encode body + $_bodyJson = Request\Body::Json($body); + + //set HTTP basic auth parameters + Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + + //call on-before Http callback + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + //and invoke the API call request to fetch the response + $response = Request::post($_queryUrl, $_headers, $_bodyJson); + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsResponse1'); } /** @@ -338,12 +521,37 @@ public function getBalance( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetBalanceResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsBalanceResponse'); } /** @@ -422,26 +630,51 @@ public function getAnticipations( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListAnticipationResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsAnticipationsResponse1'); } /** * Creates an anticipation * - * @param string $recipientId Recipient id - * @param Models\CreateAnticipationRequest $request Anticipation data - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $recipientId Recipient id + * @param Models\RecipientsAnticipationsRequest $body Anticipation data + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createAnticipation( $recipientId, - $request, + $body, $idempotencyKey = null ) { @@ -460,12 +693,12 @@ public function createAnticipation( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -487,26 +720,51 @@ public function createAnticipation( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAnticipationResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsAnticipationsResponse'); } /** * Updates the default bank account from a recipient * - * @param string $recipientId Recipient id - * @param Models\UpdateRecipientBankAccountRequest $request Bank account data - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $recipientId Recipient id + * @param Models\RecipientsDefaultBankAccountRequest $body Bank account data + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateRecipientDefaultBankAccount( $recipientId, - $request, + $body, $idempotencyKey = null ) { @@ -525,12 +783,12 @@ public function updateRecipientDefaultBankAccount( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -552,12 +810,37 @@ public function updateRecipientDefaultBankAccount( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsDefaultBankAccountResponse'); } /** @@ -608,63 +891,87 @@ public function getRecipient( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsResponse1'); } /** - * Gets the anticipation limits for a recipient + * Updates a recipient * - * @param string $recipientId Recipient id - * @param string $timeframe Timeframe - * @param DateTime $paymentDate Anticipation payment date + * @param string $recipientId Recipient id + * @param Models\RecipientsRequest1 $body Recipient data + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getAnticipationLimits( + public function updateRecipient( $recipientId, - $timeframe, - $paymentDate + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/recipients/{recipient_id}/anticipation_limits'; + $_queryBuilder = '/recipients/{recipient_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'recipient_id' => $recipientId, + 'recipient_id' => $recipientId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'timeframe' => $timeframe, - 'payment_date' => DateTimeHelper::toRfc3339DateTime($paymentDate), - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -674,12 +981,37 @@ public function getAnticipationLimits( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetAnticipationLimitResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsResponse1'); } /** @@ -733,12 +1065,37 @@ public function getTransfer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetTransferResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsTransfersResponse'); } /** @@ -808,31 +1165,56 @@ public function getTransfers( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListTransferResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsTransfersResponse1'); } /** - * Updates a recipient + * Creates a transfer for a recipient * - * @param string $recipientId Recipient id - * @param Models\UpdateRecipientRequest $request Recipient data - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $recipientId Recipient Id + * @param Models\RecipientsTransfersRequest $body Transfer data + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateRecipient( + public function createTransfer( $recipientId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/recipients/{recipient_id}'; + $_queryBuilder = '/recipients/{recipient_id}/transfers'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -846,24 +1228,24 @@ public function updateRecipient( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -873,62 +1255,29 @@ public function updateRecipient( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); - } - - /** - * Creates a new recipient - * - * @param Models\CreateRecipientRequest $request Recipient data - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function createRecipient( - $request, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/recipients'; - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); } - //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); } //handle errors defined at the API level @@ -936,57 +1285,58 @@ public function createRecipient( $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsTransfersResponse'); } /** - * Creates a transfer for a recipient + * Gets the anticipation limits for a recipient * - * @param string $recipientId Recipient Id - * @param Models\CreateTransferRequest $request Transfer data - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $recipientId Recipient id + * @param string $timeframe Timeframe + * @param DateTime $paymentDate Anticipation payment date * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createTransfer( + public function getAnticipationLimits( $recipientId, - $request, - $idempotencyKey = null + $timeframe, + $paymentDate ) { //prepare query string for API call - $_queryBuilder = '/recipients/{recipient_id}/transfers'; + $_queryBuilder = '/recipients/{recipient_id}/anticipation_limits'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'recipient_id' => $recipientId, + 'recipient_id' => $recipientId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'timeframe' => $timeframe, + 'payment_date' => DateTimeHelper::toRfc3339DateTime($paymentDate), + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -996,25 +1346,50 @@ public function createTransfer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetTransferResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsAnticipationLimitsResponse'); } /** - * @todo Add general description for this endpoint + * CreateWithdraw * * @param string $recipientId TODO: type description here - * @param Models\CreateWithdrawRequest $request TODO: type description here + * @param Models\CreateWithdrawRequest $body TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createWithdraw( $recipientId, - $request + $body ) { //prepare query string for API call @@ -1032,11 +1407,11 @@ public function createWithdraw( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' + 'Content-Type' => 'application/json' ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -1058,6 +1433,31 @@ public function createWithdraw( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -1067,27 +1467,43 @@ public function createWithdraw( } /** - * @todo Add general description for this endpoint + * Gets a paginated list of transfers for the recipient * - * @param string $recipientId TODO: type description here - * @param string $withdrawalId TODO: type description here + * @param string $recipientId TODO: type description here + * @param integer $page (optional) TODO: type description here + * @param integer $size (optional) TODO: type description here + * @param string $status (optional) TODO: type description here + * @param DateTime $createdSince (optional) TODO: type description here + * @param DateTime $createdUntil (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getWithdrawById( + public function getWithdrawals( $recipientId, - $withdrawalId + $page = null, + $size = null, + $status = null, + $createdSince = null, + $createdUntil = null ) { //prepare query string for API call - $_queryBuilder = '/recipients/{recipient_id}/withdrawals/{withdrawal_id}'; + $_queryBuilder = '/recipients/{recipient_id}/withdrawals'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'recipient_id' => $recipientId, - 'withdrawal_id' => $withdrawalId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + 'status' => $status, + 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), + 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -1117,52 +1533,61 @@ public function getWithdrawById( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetWithdrawResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListWithdrawals'); } /** - * Gets a paginated list of transfers for the recipient + * GetWithdrawById * - * @param string $recipientId TODO: type description here - * @param integer $page (optional) TODO: type description here - * @param integer $size (optional) TODO: type description here - * @param string $status (optional) TODO: type description here - * @param DateTime $createdSince (optional) TODO: type description here - * @param DateTime $createdUntil (optional) TODO: type description here + * @param string $recipientId TODO: type description here + * @param string $withdrawalId TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getWithdrawals( + public function getWithdrawById( $recipientId, - $page = null, - $size = null, - $status = null, - $createdSince = null, - $createdUntil = null + $withdrawalId ) { //prepare query string for API call - $_queryBuilder = '/recipients/{recipient_id}/withdrawals'; + $_queryBuilder = '/recipients/{recipient_id}/withdrawals/{withdrawal_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'recipient_id' => $recipientId, + 'withdrawal_id' => $withdrawalId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - 'status' => $status, - 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), - 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -1192,19 +1617,44 @@ public function getWithdrawals( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListWithdrawals'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetWithdrawResponse'); } /** * Updates recipient metadata * * @param string $recipientId Recipient id - * @param Models\UpdateAutomaticAnticipationSettingsRequest $request Metadata + * @param Models\UpdateAutomaticAnticipationSettingsRequest $body Metadata * @param string $idempotencyKey (optional) TODO: type description * here * @return mixed response from the API call @@ -1212,7 +1662,7 @@ public function getWithdrawals( */ public function updateAutomaticAnticipationSettings( $recipientId, - $request, + $body, $idempotencyKey = null ) { @@ -1231,12 +1681,12 @@ public function updateAutomaticAnticipationSettings( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -1258,12 +1708,40 @@ public function updateAutomaticAnticipationSettings( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass( + $response->body, + 'MundiAPILib\\Models\\RecipientsAutomaticAnticipationSettingsResponse' + ); } /** @@ -1314,11 +1792,36 @@ public function getRecipientByCode( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetRecipientResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\RecipientsCodeResponse'); } } diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index 3816a11..4ff5c1a 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -45,15 +45,15 @@ public static function getInstance() /** * Creates a discount * - * @param string $subscriptionId Subscription id - * @param Models\CreateDiscountRequest $request Request for creating a discount - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param Models\SubscriptionsDiscountsRequest $body Request for creating a discount + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createDiscount( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { @@ -72,12 +72,12 @@ public function createDiscount( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -99,12 +99,37 @@ public function createDiscount( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetDiscountResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsDiscountsResponse'); } /** @@ -158,6 +183,31 @@ public function getSubscriptionItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -167,31 +217,29 @@ public function getSubscriptionItem( } /** - * Deletes a usage + * Updates a subscription item * - * @param string $subscriptionId The subscription id - * @param string $itemId The subscription item id - * @param string $usageId The usage id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription Id + * @param string $itemId Item id + * @param Models\SubscriptionsItemsRequest $body Request for updating a subscription item + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteUsage( + public function updateSubscriptionItem( $subscriptionId, $itemId, - $usageId, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = - '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}'; + $_queryBuilder = '/subscriptions/{subscription_id}/items/{item_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, 'item_id' => $itemId, - 'usage_id' => $usageId, )); //validate and preprocess url @@ -201,20 +249,24 @@ public function deleteUsage( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::put($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -224,35 +276,65 @@ public function deleteUsage( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetUsageResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); } /** - * Cancels a subscription + * Deletes a usage * - * @param string $subscriptionId Subscription id - * @param Models\CreateCancelSubscriptionRequest $request (optional) Request for cancelling a subscription - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription id + * @param string $itemId The subscription item id + * @param string $usageId The usage id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function cancelSubscription( + public function deleteUsage( $subscriptionId, - $request = null, + $itemId, + $usageId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}'; + $_queryBuilder = + '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'item_id' => $itemId, + 'usage_id' => $usageId, )); //validate and preprocess url @@ -262,13 +344,9 @@ public function cancelSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -279,7 +357,7 @@ public function cancelSubscription( } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers, $_bodyJson); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -289,36 +367,60 @@ public function cancelSubscription( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsItemsUsagesUsageIdResponse'); } /** - * Deletes a increment + * Cancels a subscription * - * @param string $subscriptionId Subscription id - * @param string $incrementId Increment id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\SubscriptionsRequest $body (optional) Request for cancelling a subscription * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteIncrement( + public function cancelSubscription( $subscriptionId, - $incrementId, - $idempotencyKey = null + $idempotencyKey = null, + $body = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/increments/{increment_id}'; + $_queryBuilder = '/subscriptions/{subscription_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, - 'increment_id' => $incrementId, )); //validate and preprocess url @@ -328,9 +430,13 @@ public function deleteIncrement( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -341,7 +447,7 @@ public function deleteIncrement( } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::delete($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -351,34 +457,56 @@ public function deleteIncrement( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetIncrementResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * @todo Add general description for this endpoint + * Gets a subscription * - * @param string $subscriptionId The subscription id - * @param string $cycleId TODO: type description here + * @param string $subscriptionId Subscription id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getSubscriptionCycleById( - $subscriptionId, - $cycleId + public function getSubscription( + $subscriptionId ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/cycles/{cycleId}'; + $_queryBuilder = '/subscriptions/{subscription_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, - 'cycleId' => $cycleId, )); //validate and preprocess url @@ -410,36 +538,61 @@ public function getSubscriptionCycleById( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPeriodResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * Updates the start at date from a subscription + * Deletes a increment * - * @param string $subscriptionId The subscription id - * @param Models\UpdateSubscriptionStartAtRequest $request Request for updating the subscription start - * date - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param string $incrementId Increment id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionStartAt( + public function deleteIncrement( $subscriptionId, - $request, + $incrementId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/start-at'; + $_queryBuilder = '/subscriptions/{subscription_id}/increments/{increment_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'increment_id' => $incrementId, )); //validate and preprocess url @@ -449,24 +602,20 @@ public function updateSubscriptionStartAt( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -476,36 +625,59 @@ public function updateSubscriptionStartAt( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsIncrementsResponse'); } /** - * Updates the payment method from a subscription + * GetIncrementById * - * @param string $subscriptionId Subscription id - * @param Models\UpdateSubscriptionPaymentMethodRequest $request Request for updating the paymentmethod - * from a subscription - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription Id + * @param string $incrementId The increment Id * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionPaymentMethod( + public function getIncrementById( $subscriptionId, - $request, - $idempotencyKey = null + $incrementId ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/payment-method'; + $_queryBuilder = '/subscriptions/{subscription_id}/increments/{increment_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'increment_id' => $incrementId, )); //validate and preprocess url @@ -514,25 +686,20 @@ public function updateSubscriptionPaymentMethod( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -542,36 +709,59 @@ public function updateSubscriptionPaymentMethod( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsIncrementsResponse'); } /** - * @todo Add general description for this endpoint + * GetSubscriptionCycleById * - * @param string $subscriptionId Subscription Id - * @param Models\UpdateCurrentCycleStatusRequest $request Request for updating the end date of the - * subscription current status - * @param string $idempotencyKey (optional) TODO: type description here - * @return void response from the API call + * @param string $subscriptionId The subscription id + * @param string $cycleId TODO: type description here + * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateCurrentCycleStatus( + public function getSubscriptionCycleById( $subscriptionId, - $request, - $idempotencyKey = null + $cycleId ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/cycle-status'; + $_queryBuilder = '/subscriptions/{subscription_id}/cycles/{cycleId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'cycleId' => $cycleId, )); //validate and preprocess url @@ -580,24 +770,20 @@ public function updateCurrentCycleStatus( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -607,25 +793,61 @@ public function updateCurrentCycleStatus( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsCyclesResponse'); } /** - * Creates a new subscription + * Updates the start at date from a subscription * - * @param Models\CreateSubscriptionRequest $body Request for creating a subscription - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription id + * @param Models\SubscriptionsStartAtRequest $body Request for updating the subscription start date + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createSubscription( + public function updateSubscriptionStartAt( + $subscriptionId, $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions'; + $_queryBuilder = '/subscriptions/{subscription_id}/start-at'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'subscription_id' => $subscriptionId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -634,7 +856,7 @@ public function createSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -645,13 +867,13 @@ public function createSubscription( Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -661,6 +883,31 @@ public function createSubscription( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -670,63 +917,54 @@ public function createSubscription( } /** - * @todo Add general description for this endpoint + * Updates the payment method from a subscription * - * @param string $subscriptionId Subscription Identifier - * @param string $cycleId (optional) Cycle id - * @param integer $size (optional) Page size - * @param integer $page (optional) Page number - * @param string $itemId (optional) Identificador do item - * @param string $group (optional) identificador da loja (account) de cada item + * @param string $subscriptionId Subscription id + * @param Models\SubscriptionsPaymentMethodRequest $body Request for updating the paymentmethod from a + * subscription + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getUsagesDetails( + public function updateSubscriptionPaymentMethod( $subscriptionId, - $cycleId = null, - $size = null, - $page = null, - $itemId = null, - $group = null + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/usages-details/'; + $_queryBuilder = '/subscriptions/{subscription_id}/payment-method'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'cycle_id' => $cycleId, - 'size' => $size, - 'page' => $page, - 'item_id' => $itemId, - 'group' => $group, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -736,29 +974,57 @@ public function getUsagesDetails( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetUsagesDetailsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * @todo Add general description for this endpoint + * UpdateCurrentCycleStatus * - * @param string $subscriptionId TODO: type description here - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call + * @param string $subscriptionId Subscription Id + * @param Models\UpdateCurrentCycleStatusRequest $body Request for updating the end date of the + * subscription current status + * @param string $idempotencyKey (optional) TODO: type description here + * @return void response from the API call * @throws APIException Thrown if API call fails */ - public function renewSubscription( + public function updateCurrentCycleStatus( $subscriptionId, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/cycles'; + $_queryBuilder = '/subscriptions/{subscription_id}/cycle-status'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -771,21 +1037,24 @@ public function renewSubscription( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -795,39 +1064,50 @@ public function renewSubscription( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - $mapper = $this->getJsonMapper(); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetPeriodResponse'); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); } /** - * Updates a subscription item + * Creates a new subscription * - * @param string $subscriptionId Subscription Id - * @param string $itemId Item id - * @param Models\UpdateSubscriptionItemRequest $body Request for updating a subscription item - * @param string $idempotencyKey (optional) TODO: type description here + * @param Models\SubscriptionsRequest1 $body Request for creating a subscription + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionItem( - $subscriptionId, - $itemId, + public function createSubscription( $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/items/{item_id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'subscription_id' => $subscriptionId, - 'item_id' => $itemId, - )); + $_queryBuilder = '/subscriptions'; //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -836,7 +1116,7 @@ public function updateSubscriptionItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -847,13 +1127,13 @@ public function updateSubscriptionItem( Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -863,59 +1143,111 @@ public function updateSubscriptionItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * Create Usage + * Gets all subscriptions * - * @param string $subscriptionId Subscription id - * @param string $itemId Item id - * @param string $idempotencyKey (optional) TODO: type description here + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size + * @param string $code (optional) Filter for subscription's code + * @param string $billingType (optional) Filter for subscription's billing type + * @param string $customerId (optional) Filter for subscription's customer id + * @param string $planId (optional) Filter for subscription's plan id + * @param string $cardId (optional) Filter for subscription's card id + * @param string $status (optional) Filter for subscription's status + * @param DateTime $nextBillingSince (optional) Filter for subscription's next billing date start range + * @param DateTime $nextBillingUntil (optional) Filter for subscription's next billing date end range + * @param DateTime $createdSince (optional) Filter for subscription's creation date start range + * @param DateTime $createdUntil (optional) Filter for subscriptions creation date end range * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createAnUsage( - $subscriptionId, - $itemId, - $idempotencyKey = null + public function getSubscriptions( + $page = null, + $size = null, + $code = null, + $billingType = null, + $customerId = null, + $planId = null, + $cardId = null, + $status = null, + $nextBillingSince = null, + $nextBillingUntil = null, + $createdSince = null, + $createdUntil = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/items/{item_id}/usages'; + $_queryBuilder = '/subscriptions'; //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'subscription_id' => $subscriptionId, - 'item_id' => $itemId, - )); + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + 'code' => $code, + 'billing_type' => $billingType, + 'customer_id' => $customerId, + 'plan_id' => $planId, + 'card_id' => $cardId, + 'status' => $status, + 'next_billing_since' => DateTimeHelper::toRfc3339DateTime($nextBillingSince), + 'next_billing_until' => DateTimeHelper::toRfc3339DateTime($nextBillingUntil), + 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), + 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'idempotency-key' => $idempotencyKey + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json' ); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -925,36 +1257,77 @@ public function createAnUsage( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetUsageResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsResponse3'); } /** - * @todo Add general description for this endpoint + * GetUsagesDetails * - * @param string $subscriptionId The subscription Id - * @param string $incrementId The increment Id + * @param string $subscriptionId Subscription Identifier + * @param string $cycleId (optional) Cycle id + * @param integer $size (optional) Page size + * @param integer $page (optional) Page number + * @param string $itemId (optional) Identificador do item + * @param string $group (optional) identificador da loja (account) de cada item * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getIncrementById( + public function getUsagesDetails( $subscriptionId, - $incrementId + $cycleId = null, + $size = null, + $page = null, + $itemId = null, + $group = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/increments/{increment_id}'; + $_queryBuilder = '/subscriptions/{subscription_id}/usages-details/'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, - 'increment_id' => $incrementId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'cycle_id' => $cycleId, + 'size' => $size, + 'page' => $page, + 'item_id' => $itemId, + 'group' => $group, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -984,36 +1357,58 @@ public function getIncrementById( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - $mapper = $this->getJsonMapper(); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetIncrementResponse'); - } + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + + //handle errors defined at the API level + $this->validateResponse($_httpResponse, $_httpContext); + + $mapper = $this->getJsonMapper(); + + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetUsagesDetailsResponse'); + } /** - * Deletes a discount + * RenewSubscription * - * @param string $subscriptionId Subscription id - * @param string $discountId Discount Id + * @param string $subscriptionId TODO: type description here * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteDiscount( + public function renewSubscription( $subscriptionId, - $discountId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/discounts/{discount_id}'; + $_queryBuilder = '/subscriptions/{subscription_id}/cycles'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, - 'discount_id' => $discountId, )); //validate and preprocess url @@ -1030,13 +1425,13 @@ public function deleteDiscount( Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::post($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1046,31 +1441,56 @@ public function deleteDiscount( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetDiscountResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsCyclesResponse'); } /** - * @todo Add general description for this endpoint + * GetSubscriptionCycles * - * @param string $subscriptionId The subscription id - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size + * @param string $subscriptionId Subscription Id + * @param string $page Page number + * @param string $size Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getIncrements( + public function getSubscriptionCycles( $subscriptionId, - $page = null, - $size = null + $page, + $size ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/increments/'; + $_queryBuilder = '/subscriptions/{subscription_id}/cycles'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -1112,28 +1532,51 @@ public function getIncrements( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListIncrementsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsCyclesResponse2'); } /** - * Creates a usage + * Create Usage * - * @param string $subscriptionId Subscription Id - * @param string $itemId Item id - * @param Models\CreateUsageRequest $body Request for creating a usage - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param string $itemId Item id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createUsage( + public function createAnUsage( $subscriptionId, $itemId, - $body, $idempotencyKey = null ) { @@ -1153,13 +1596,9 @@ public function createUsage( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($body); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -1170,7 +1609,7 @@ public function createUsage( } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1180,69 +1619,29 @@ public function createUsage( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetUsageResponse'); - } - - /** - * Creates a new Subscription item - * - * @param string $subscriptionId Subscription id - * @param Models\CreateSubscriptionItemRequest $request Request for creating a subscription item - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function createSubscriptionItem( - $subscriptionId, - $request, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/items'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'subscription_id' => $subscriptionId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); } - //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); } //handle errors defined at the API level @@ -1250,7 +1649,7 @@ public function createSubscriptionItem( $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsItemsUsagesResponse'); } /** @@ -1326,36 +1725,61 @@ public function getUsages( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListUsagesResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsItemsUsagesResponse1'); } /** - * Updates the billing date from a subscription + * Deletes a discount * - * @param string $subscriptionId The subscription id - * @param Models\UpdateSubscriptionBillingDateRequest $request Request for updating the subscription - * billing date - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param string $discountId Discount Id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionBillingDate( + public function deleteDiscount( $subscriptionId, - $request, + $discountId, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/billing-date'; + $_queryBuilder = '/subscriptions/{subscription_id}/discounts/{discount_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'discount_id' => $discountId, )); //validate and preprocess url @@ -1365,24 +1789,20 @@ public function updateSubscriptionBillingDate( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', 'idempotency-key' => $idempotencyKey ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1392,63 +1812,88 @@ public function updateSubscriptionBillingDate( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsDiscountsResponse'); } /** - * @todo Add general description for this endpoint + * GetIncrements * - * @param string $subscriptionId TODO: type description here - * @param Models\UpdateCurrentCycleEndDateRequest $request Request for updating the end date of the current - * signature cycle - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription id + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateLatestPeriodEndAt( + public function getIncrements( $subscriptionId, - $request, - $idempotencyKey = null + $page = null, + $size = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/periods/latest/end-at'; + $_queryBuilder = '/subscriptions/{subscription_id}/increments/'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1458,63 +1903,87 @@ public function updateLatestPeriodEndAt( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListIncrementsResponse'); } /** - * @todo Add general description for this endpoint + * Creates a new Subscription item * - * @param string $subscriptionId Subscription Id - * @param string $page Page number - * @param string $size Page size + * @param string $subscriptionId Subscription id + * @param Models\SubscriptionsItemsRequest1 $body Request for creating a subscription item + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getSubscriptionCycles( + public function createSubscriptionItem( $subscriptionId, - $page, - $size + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/cycles'; + $_queryBuilder = '/subscriptions/{subscription_id}/items'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1524,64 +1993,84 @@ public function getSubscriptionCycles( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListCyclesResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); } /** - * Gets all subscriptions + * Get Subscription Items * - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size - * @param string $code (optional) Filter for subscription's code - * @param string $billingType (optional) Filter for subscription's billing type - * @param string $customerId (optional) Filter for subscription's customer id - * @param string $planId (optional) Filter for subscription's plan id - * @param string $cardId (optional) Filter for subscription's card id - * @param string $status (optional) Filter for subscription's status - * @param DateTime $nextBillingSince (optional) Filter for subscription's next billing date start range - * @param DateTime $nextBillingUntil (optional) Filter for subscription's next billing date end range - * @param DateTime $createdSince (optional) Filter for subscription's creation date start range - * @param DateTime $createdUntil (optional) Filter for subscriptions creation date end range + * @param string $subscriptionId The subscription id + * @param integer $page (optional) Page number + * @param integer $size (optional) Page size + * @param string $name (optional) The item name + * @param string $code (optional) Identification code in the client system + * @param string $status (optional) The item statis + * @param string $description (optional) The item description + * @param string $createdSince (optional) Filter for item's creation date start range + * @param string $createdUntil (optional) Filter for item's creation date end range * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getSubscriptions( + public function getSubscriptionItems( + $subscriptionId, $page = null, $size = null, + $name = null, $code = null, - $billingType = null, - $customerId = null, - $planId = null, - $cardId = null, $status = null, - $nextBillingSince = null, - $nextBillingUntil = null, + $description = null, $createdSince = null, $createdUntil = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions'; + $_queryBuilder = '/subscriptions/{subscription_id}/items'; + + //process optional query parameters + $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( + 'subscription_id' => $subscriptionId, + )); //process optional query parameters APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - 'code' => $code, - 'billing_type' => $billingType, - 'customer_id' => $customerId, - 'plan_id' => $planId, - 'card_id' => $cardId, - 'status' => $status, - 'next_billing_since' => DateTimeHelper::toRfc3339DateTime($nextBillingSince), - 'next_billing_until' => DateTimeHelper::toRfc3339DateTime($nextBillingUntil), - 'created_since' => DateTimeHelper::toRfc3339DateTime($createdSince), - 'created_until' => DateTimeHelper::toRfc3339DateTime($createdUntil), + 'page' => $page, + 'size' => $size, + 'name' => $name, + 'code' => $code, + 'status' => $status, + 'description' => $description, + 'created_since' => $createdSince, + 'created_until' => $createdUntil, )); //validate and preprocess url @@ -1589,8 +2078,8 @@ public function getSubscriptions( //prepare headers $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json' ); //set HTTP basic auth parameters @@ -1613,34 +2102,61 @@ public function getSubscriptions( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListSubscriptionsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsItemsResponse3'); } /** - * @todo Add general description for this endpoint + * Updates the billing date from a subscription * - * @param string $subscriptionId The subscription id - * @param string $discountId TODO: type description here + * @param string $subscriptionId The subscription id + * @param Models\SubscriptionsBillingDateRequest $body Request for updating the subscription billing + * date + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getDiscountById( + public function updateSubscriptionBillingDate( $subscriptionId, - $discountId + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/discounts/{discountId}'; + $_queryBuilder = '/subscriptions/{subscription_id}/billing-date'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, - 'discountId' => $discountId, )); //validate and preprocess url @@ -1649,20 +2165,25 @@ public function getDiscountById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1672,81 +2193,88 @@ public function getDiscountById( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetDiscountResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * Get Subscription Items + * UpdateLatestPeriodEndAt * - * @param string $subscriptionId The subscription id - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size - * @param string $name (optional) The item name - * @param string $code (optional) Identification code in the client system - * @param string $status (optional) The item statis - * @param string $description (optional) The item description - * @param string $createdSince (optional) Filter for item's creation date start range - * @param string $createdUntil (optional) Filter for item's creation date end range + * @param string $subscriptionId TODO: type description here + * @param Models\SubscriptionsPeriodsLatestEndAtRequest $body Request for updating the end date of the + * current signature cycle + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getSubscriptionItems( + public function updateLatestPeriodEndAt( $subscriptionId, - $page = null, - $size = null, - $name = null, - $code = null, - $status = null, - $description = null, - $createdSince = null, - $createdUntil = null + $body, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/items'; + $_queryBuilder = '/subscriptions/{subscription_id}/periods/latest/end-at'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - 'name' => $name, - 'code' => $code, - 'status' => $status, - 'description' => $description, - 'created_since' => $createdSince, - 'created_until' => $createdUntil, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1756,32 +2284,57 @@ public function getSubscriptionItems( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListSubscriptionItemsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * Atualização do valor mínimo da assinatura + * UpdateSubscriptionAffiliationId * - * @param string $subscriptionId Subscription Id - * @param Models\UpdateSubscriptionMinimumPriceRequest $request Request da requisição com o valor mínimo - * que será configurado - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId TODO: type description here + * @param Models\SubscriptionsGatewayAffiliationIdRequest $body Request for updating a subscription + * affiliation id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionMiniumPrice( + public function updateSubscriptionAffiliationId( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/minimum_price'; + $_queryBuilder = '/subscriptions/{subscription_id}/gateway-affiliation-id'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -1795,12 +2348,12 @@ public function updateSubscriptionMiniumPrice( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -1822,6 +2375,31 @@ public function updateSubscriptionMiniumPrice( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -1831,22 +2409,28 @@ public function updateSubscriptionMiniumPrice( } /** - * Gets a subscription + * Deletes a subscription item * - * @param string $subscriptionId Subscription id + * @param string $subscriptionId Subscription id + * @param string $subscriptionItemId Subscription item id + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getSubscription( - $subscriptionId + public function deleteSubscriptionItem( + $subscriptionId, + $subscriptionItemId, + $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}'; + $_queryBuilder = + '/subscriptions/{subscription_id}/items/{subscription_item_id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'subscription_id' => $subscriptionId, + 'subscription_id' => $subscriptionId, + 'subscription_item_id' => $subscriptionItemId, )); //validate and preprocess url @@ -1854,21 +2438,22 @@ public function getSubscription( //prepare headers $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'idempotency-key' => $idempotencyKey ); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); + $response = Request::delete($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -1878,32 +2463,56 @@ public function getSubscription( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); } /** - * @todo Add general description for this endpoint + * Updates the credit card from a subscription * - * @param string $subscriptionId TODO: type description here - * @param Models\UpdateSubscriptionAffiliationIdRequest $request Request for updating a subscription - * affiliation id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param Models\SubscriptionsCardRequest $body Request for updating a card + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionAffiliationId( + public function updateSubscriptionCard( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/gateway-affiliation-id'; + $_queryBuilder = '/subscriptions/{subscription_id}/card'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -1917,12 +2526,12 @@ public function updateSubscriptionAffiliationId( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -1944,6 +2553,31 @@ public function updateSubscriptionAffiliationId( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -1953,28 +2587,26 @@ public function updateSubscriptionAffiliationId( } /** - * Deletes a subscription item + * Updates the metadata from a subscription * - * @param string $subscriptionId Subscription id - * @param string $subscriptionItemId Subscription item id - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription id + * @param Models\SubscriptionsMetadataRequest $body Request for updating the subscrption metadata + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function deleteSubscriptionItem( + public function updateSubscriptionMetadata( $subscriptionId, - $subscriptionItemId, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = - '/subscriptions/{subscription_id}/items/{subscription_item_id}'; + $_queryBuilder = '/Subscriptions/{subscription_id}/metadata'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'subscription_id' => $subscriptionId, - 'subscription_item_id' => $subscriptionItemId, + 'subscription_id' => $subscriptionId, )); //validate and preprocess url @@ -1982,22 +2614,26 @@ public function deleteSubscriptionItem( //prepare headers $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'idempotency-key' => $idempotencyKey + 'user-agent' => BaseController::USER_AGENT, + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'idempotency-key' => $idempotencyKey ); + //json encode body + $_bodyJson = Request\Body::Json($body); + //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -2007,31 +2643,56 @@ public function deleteSubscriptionItem( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionItemResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * Updates the credit card from a subscription + * Updates the boleto due days from a subscription * - * @param string $subscriptionId Subscription id - * @param Models\UpdateSubscriptionCardRequest $request Request for updating a card - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription Id + * @param Models\UpdateSubscriptionDueDaysRequest $body TODO: type description here + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionCard( + public function updateSubscriptionDueDays( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/card'; + $_queryBuilder = '/subscriptions/{subscription_id}/boleto-due-days'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -2045,12 +2706,12 @@ public function updateSubscriptionCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -2072,6 +2733,31 @@ public function updateSubscriptionCard( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -2081,53 +2767,54 @@ public function updateSubscriptionCard( } /** - * Updates the metadata from a subscription + * GetDiscounts * - * @param string $subscriptionId The subscription id - * @param Models\UpdateMetadataRequest $request Request for updating the subscrption metadata - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId The subscription id + * @param integer $page Page number + * @param integer $size Page size * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionMetadata( + public function getDiscounts( $subscriptionId, - $request, - $idempotencyKey = null + $page, + $size ) { //prepare query string for API call - $_queryBuilder = '/Subscriptions/{subscription_id}/metadata'; + $_queryBuilder = '/subscriptions/{subscription_id}/discounts/'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'page' => $page, + 'size' => $size, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey + 'Accept' => 'application/json' ); - //json encode body - $_bodyJson = Request\Body::Json($request); - //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::get($_queryUrl, $_headers); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -2137,31 +2824,56 @@ public function updateSubscriptionMetadata( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListDiscountsResponse'); } /** - * Updates the boleto due days from a subscription + * Creates a increment * - * @param string $subscriptionId Subscription Id - * @param Models\UpdateSubscriptionDueDaysRequest $request TODO: type description here - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription id + * @param Models\SubscriptionsIncrementsRequest $body Request for creating a increment + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function updateSubscriptionDueDays( + public function createIncrement( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/boleto-due-days'; + $_queryBuilder = '/subscriptions/{subscription_id}/increments'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -2175,24 +2887,24 @@ public function updateSubscriptionDueDays( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); + $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -2202,43 +2914,61 @@ public function updateSubscriptionDueDays( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsIncrementsResponse'); } /** - * @todo Add general description for this endpoint + * GetDiscountById * - * @param string $subscriptionId The subscription id - * @param integer $page Page number - * @param integer $size Page size + * @param string $subscriptionId The subscription id + * @param string $discountId TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getDiscounts( + public function getDiscountById( $subscriptionId, - $page, - $size + $discountId ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/discounts/'; + $_queryBuilder = '/subscriptions/{subscription_id}/discounts/{discountId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'subscription_id' => $subscriptionId, + 'discountId' => $discountId, )); - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - )); - //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -2268,31 +2998,57 @@ public function getDiscounts( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\ListDiscountsResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\SubscriptionsDiscountsResponse'); } /** - * Creates a increment + * Atualização do valor mínimo da assinatura * - * @param string $subscriptionId Subscription id - * @param Models\CreateIncrementRequest $request Request for creating a increment - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $subscriptionId Subscription Id + * @param Models\SubscriptionsMinimumPriceRequest $body Request da requisição com o valor mínimo que + * será configurado + * @param string $idempotencyKey (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createIncrement( + public function updateSubscriptionMiniumPrice( $subscriptionId, - $request, + $body, $idempotencyKey = null ) { //prepare query string for API call - $_queryBuilder = '/subscriptions/{subscription_id}/increments'; + $_queryBuilder = '/subscriptions/{subscription_id}/minimum_price'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -2306,24 +3062,24 @@ public function createIncrement( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); + $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); + $response = Request::patch($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); @@ -2333,16 +3089,41 @@ public function createIncrement( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetIncrementResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetSubscriptionResponse'); } /** - * @todo Add general description for this endpoint + * GetUsageReport * * @param string $subscriptionId The subscription Id * @param string $periodId The period Id @@ -2393,6 +3174,31 @@ public function getUsageReport( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -2402,16 +3208,16 @@ public function getUsageReport( } /** - * @todo Add general description for this endpoint + * UpdateSplitSubscription * - * @param string $id Subscription's id - * @param Models\UpdateSubscriptionSplitRequest $request TODO: type description here + * @param string $id Subscription's id + * @param Models\UpdateSubscriptionSplitRequest $body TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function updateSplitSubscription( $id, - $request + $body ) { //prepare query string for API call @@ -2419,7 +3225,7 @@ public function updateSplitSubscription( //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'id' => $id, + 'id' => $id, )); //validate and preprocess url @@ -2429,11 +3235,11 @@ public function updateSplitSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' + 'Content-Type' => 'application/json' ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -2455,6 +3261,31 @@ public function updateSplitSubscription( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); diff --git a/src/Controllers/TokensController.php b/src/Controllers/TokensController.php index a5fe0a5..d4207c6 100644 --- a/src/Controllers/TokensController.php +++ b/src/Controllers/TokensController.php @@ -42,28 +42,35 @@ public static function getInstance() } /** - * @todo Add general description for this endpoint + * CreateToken * - * @param string $publicKey Public key - * @param Models\CreateTokenRequest $request Request for creating a token - * @param string $idempotencyKey (optional) TODO: type description here + * @param string $publicKey Public key + * @param Models\TokensRequest $body Request for creating a token + * @param string $idempotencyKey (optional) TODO: type description here + * @param string $appId (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function createToken( $publicKey, - $request, - $idempotencyKey = null + $body, + $idempotencyKey = null, + $appId = null ) { //prepare query string for API call - $_queryBuilder = '/tokens?appId={public_key}'; + $_queryBuilder = '/tokens'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'public_key' => $publicKey, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'appId' => $appId, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -71,12 +78,12 @@ public function createToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', + 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -98,12 +105,37 @@ public function createToken( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetTokenResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\TokensResponse'); } /** @@ -111,16 +143,18 @@ public function createToken( * * @param string $id Token id * @param string $publicKey Public key + * @param string $appId (optional) TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ public function getToken( $id, - $publicKey + $publicKey, + $appId = null ) { //prepare query string for API call - $_queryBuilder = '/tokens/{id}?appId={public_key}'; + $_queryBuilder = '/tokens/{id}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( @@ -128,6 +162,11 @@ public function getToken( 'public_key' => $publicKey, )); + //process optional query parameters + APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( + 'appId' => $appId, + )); + //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); @@ -157,11 +196,36 @@ public function getToken( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); $mapper = $this->getJsonMapper(); - return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\GetTokenResponse'); + return $mapper->mapClass($response->body, 'MundiAPILib\\Models\\TokensResponse'); } } diff --git a/src/Controllers/TransactionsController.php b/src/Controllers/TransactionsController.php index 25410e7..6ff435d 100644 --- a/src/Controllers/TransactionsController.php +++ b/src/Controllers/TransactionsController.php @@ -42,7 +42,7 @@ public static function getInstance() } /** - * @todo Add general description for this endpoint + * GetTransaction * * @param string $transactionId TODO: type description here * @return mixed response from the API call @@ -89,6 +89,31 @@ public function getTransaction( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); diff --git a/src/Controllers/TransfersController.php b/src/Controllers/TransfersController.php index fe3bcab..7df9587 100644 --- a/src/Controllers/TransfersController.php +++ b/src/Controllers/TransfersController.php @@ -42,14 +42,14 @@ public static function getInstance() } /** - * @todo Add general description for this endpoint + * CreateTransfer * - * @param Models\CreateTransfer $request TODO: type description here + * @param Models\CreateTransfer $body TODO: type description here * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function createTransfer( - $request + public function postCreateTransfer( + $body ) { //prepare query string for API call @@ -62,11 +62,11 @@ public function createTransfer( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' + 'Content-Type' => 'application/json' ); //json encode body - $_bodyJson = Request\Body::Json($request); + $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); @@ -88,6 +88,31 @@ public function createTransfer( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -97,7 +122,7 @@ public function createTransfer( } /** - * @todo Add general description for this endpoint + * GetTransferById * * @param string $transferId TODO: type description here * @return mixed response from the API call @@ -144,6 +169,31 @@ public function getTransferById( $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); @@ -158,7 +208,7 @@ public function getTransferById( * @return mixed response from the API call * @throws APIException Thrown if API call fails */ - public function getTransfers() + public function getTransfers1() { //prepare query string for API call @@ -193,6 +243,31 @@ public function getTransfers() $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } + //Error handling using HTTP status codes + if ($response->code == 400) { + throw new Exceptions\ErrorException('Invalid request', $_httpContext); + } + + if ($response->code == 401) { + throw new Exceptions\ErrorException('Invalid API key', $_httpContext); + } + + if ($response->code == 404) { + throw new Exceptions\ErrorException('An informed resource was not found', $_httpContext); + } + + if ($response->code == 412) { + throw new Exceptions\ErrorException('Business validation error', $_httpContext); + } + + if ($response->code == 422) { + throw new Exceptions\ErrorException('Contract validation error', $_httpContext); + } + + if ($response->code == 500) { + throw new Exceptions\ErrorException('Internal server error', $_httpContext); + } + //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); diff --git a/src/Models/Address.php b/src/Models/Address.php new file mode 100644 index 0000000..239b511 --- /dev/null +++ b/src/Models/Address.php @@ -0,0 +1,215 @@ +id + * @param string $street Initialization value for $this->street + * @param string $number Initialization value for $this->number + * @param string $complement Initialization value for $this->complement + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->street = func_get_arg(1); + $this->number = func_get_arg(2); + $this->complement = func_get_arg(3); + $this->zipCode = func_get_arg(4); + $this->neighborhood = func_get_arg(5); + $this->city = func_get_arg(6); + $this->state = func_get_arg(7); + $this->country = func_get_arg(8); + $this->status = func_get_arg(9); + $this->createdAt = func_get_arg(10); + $this->updatedAt = func_get_arg(11); + $this->customer = func_get_arg(12); + $this->metadata = func_get_arg(13); + $this->line1 = func_get_arg(14); + $this->line2 = func_get_arg(15); + $this->deletedAt = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['complement'] = $this->complement; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/Address1.php b/src/Models/Address1.php new file mode 100644 index 0000000..ca8cc08 --- /dev/null +++ b/src/Models/Address1.php @@ -0,0 +1,150 @@ +street + * @param string $number Initialization value for $this->number + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $complement Initialization value for $this->complement + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->street = func_get_arg(0); + $this->number = func_get_arg(1); + $this->zipCode = func_get_arg(2); + $this->neighborhood = func_get_arg(3); + $this->city = func_get_arg(4); + $this->state = func_get_arg(5); + $this->country = func_get_arg(6); + $this->complement = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->line1 = func_get_arg(9); + $this->line2 = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['complement'] = $this->complement; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + + return $json; + } +} diff --git a/src/Models/ApplePay.php b/src/Models/ApplePay.php new file mode 100644 index 0000000..c37443d --- /dev/null +++ b/src/Models/ApplePay.php @@ -0,0 +1,87 @@ +version + * @param string $data Initialization value for $this->data + * @param Header $header Initialization value for $this->header + * @param string $signature Initialization value for $this->signature + * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->version = func_get_arg(0); + $this->data = func_get_arg(1); + $this->header = func_get_arg(2); + $this->signature = func_get_arg(3); + $this->merchantIdentifier = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['version'] = $this->version; + $json['data'] = $this->data; + $json['header'] = $this->header; + $json['signature'] = $this->signature; + $json['merchant_identifier'] = $this->merchantIdentifier; + + return $json; + } +} diff --git a/src/Models/Authentication.php b/src/Models/Authentication.php new file mode 100644 index 0000000..f049cb5 --- /dev/null +++ b/src/Models/Authentication.php @@ -0,0 +1,57 @@ +type + * @param ThreedSecure $threedSecure Initialization value for $this->threedSecure + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->type = func_get_arg(0); + $this->threedSecure = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['threed_secure'] = $this->threedSecure; + + return $json; + } +} diff --git a/src/Models/Authentication2.php b/src/Models/Authentication2.php new file mode 100644 index 0000000..1731563 --- /dev/null +++ b/src/Models/Authentication2.php @@ -0,0 +1,57 @@ +type + * @param ThreedSecure1 $threedSecure Initialization value for $this->threedSecure + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->type = func_get_arg(0); + $this->threedSecure = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['threed_secure'] = $this->threedSecure; + + return $json; + } +} diff --git a/src/Models/BankAccount.php b/src/Models/BankAccount.php new file mode 100644 index 0000000..a6db062 --- /dev/null +++ b/src/Models/BankAccount.php @@ -0,0 +1,209 @@ +id + * @param string $holderName Initialization value for $this->holderName + * @param string $holderType Initialization value for $this->holderType + * @param string $bank Initialization value for $this->bank + * @param string $branchNumber Initialization value for $this->branchNumber + * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit + * @param string $accountNumber Initialization value for $this->accountNumber + * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit + * @param string $type Initialization value for $this->type + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param Recipient $recipient Initialization value for $this->recipient + * @param array $metadata Initialization value for $this->metadata + * @param string $pixKey Initialization value for $this->pixKey + */ + public function __construct() + { + if (16 == func_num_args()) { + $this->id = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->holderType = func_get_arg(2); + $this->bank = func_get_arg(3); + $this->branchNumber = func_get_arg(4); + $this->branchCheckDigit = func_get_arg(5); + $this->accountNumber = func_get_arg(6); + $this->accountCheckDigit = func_get_arg(7); + $this->type = func_get_arg(8); + $this->status = func_get_arg(9); + $this->createdAt = func_get_arg(10); + $this->updatedAt = func_get_arg(11); + $this->deletedAt = func_get_arg(12); + $this->recipient = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->pixKey = func_get_arg(15); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['holder_name'] = $this->holderName; + $json['holder_type'] = $this->holderType; + $json['bank'] = $this->bank; + $json['branch_number'] = $this->branchNumber; + $json['branch_check_digit'] = $this->branchCheckDigit; + $json['account_number'] = $this->accountNumber; + $json['account_check_digit'] = $this->accountCheckDigit; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['recipient'] = $this->recipient; + $json['metadata'] = $this->metadata; + $json['pix_key'] = $this->pixKey; + + return $json; + } +} diff --git a/src/Models/BankAccount1.php b/src/Models/BankAccount1.php new file mode 100644 index 0000000..13e3741 --- /dev/null +++ b/src/Models/BankAccount1.php @@ -0,0 +1,154 @@ +holderName + * @param string $holderType Initialization value for $this->holderType + * @param string $holderDocument Initialization value for $this->holderDocument + * @param string $bank Initialization value for $this->bank + * @param string $branchNumber Initialization value for $this->branchNumber + * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit + * @param string $accountNumber Initialization value for $this->accountNumber + * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit + * @param string $type Initialization value for $this->type + * @param array $metadata Initialization value for $this->metadata + * @param string $pixKey Initialization value for $this->pixKey + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->holderName = func_get_arg(0); + $this->holderType = func_get_arg(1); + $this->holderDocument = func_get_arg(2); + $this->bank = func_get_arg(3); + $this->branchNumber = func_get_arg(4); + $this->branchCheckDigit = func_get_arg(5); + $this->accountNumber = func_get_arg(6); + $this->accountCheckDigit = func_get_arg(7); + $this->type = func_get_arg(8); + $this->metadata = func_get_arg(9); + $this->pixKey = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['holder_name'] = $this->holderName; + $json['holder_type'] = $this->holderType; + $json['holder_document'] = $this->holderDocument; + $json['bank'] = $this->bank; + $json['branch_number'] = $this->branchNumber; + $json['branch_check_digit'] = $this->branchCheckDigit; + $json['account_number'] = $this->accountNumber; + $json['account_check_digit'] = $this->accountCheckDigit; + $json['type'] = $this->type; + $json['metadata'] = $this->metadata; + $json['pix_key'] = $this->pixKey; + + return $json; + } +} diff --git a/src/Models/BankTransfer.php b/src/Models/BankTransfer.php new file mode 100644 index 0000000..84f9cc0 --- /dev/null +++ b/src/Models/BankTransfer.php @@ -0,0 +1,46 @@ +bank + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->bank = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['bank'] = $this->bank; + + return $json; + } +} diff --git a/src/Models/BankTransfer1.php b/src/Models/BankTransfer1.php new file mode 100644 index 0000000..e29a6ce --- /dev/null +++ b/src/Models/BankTransfer1.php @@ -0,0 +1,56 @@ +bank + * @param integer $retries Initialization value for $this->retries + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->bank = func_get_arg(0); + $this->retries = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['bank'] = $this->bank; + $json['retries'] = $this->retries; + + return $json; + } +} diff --git a/src/Models/BankTransfer2.php b/src/Models/BankTransfer2.php new file mode 100644 index 0000000..b3e1276 --- /dev/null +++ b/src/Models/BankTransfer2.php @@ -0,0 +1,56 @@ +bank + * @param integer $retries Initialization value for $this->retries + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->bank = func_get_arg(0); + $this->retries = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['bank'] = $this->bank; + $json['retries'] = $this->retries; + + return $json; + } +} diff --git a/src/Models/BillingAddress.php b/src/Models/BillingAddress.php new file mode 100644 index 0000000..43252b6 --- /dev/null +++ b/src/Models/BillingAddress.php @@ -0,0 +1,139 @@ +street + * @param string $number Initialization value for $this->number + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $complement Initialization value for $this->complement + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->street = func_get_arg(0); + $this->number = func_get_arg(1); + $this->zipCode = func_get_arg(2); + $this->neighborhood = func_get_arg(3); + $this->city = func_get_arg(4); + $this->state = func_get_arg(5); + $this->country = func_get_arg(6); + $this->complement = func_get_arg(7); + $this->line1 = func_get_arg(8); + $this->line2 = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['complement'] = $this->complement; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + + return $json; + } +} diff --git a/src/Models/BillingAddress1.php b/src/Models/BillingAddress1.php new file mode 100644 index 0000000..cf06787 --- /dev/null +++ b/src/Models/BillingAddress1.php @@ -0,0 +1,150 @@ +street + * @param string $number Initialization value for $this->number + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $complement Initialization value for $this->complement + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->street = func_get_arg(0); + $this->number = func_get_arg(1); + $this->zipCode = func_get_arg(2); + $this->neighborhood = func_get_arg(3); + $this->city = func_get_arg(4); + $this->state = func_get_arg(5); + $this->country = func_get_arg(6); + $this->complement = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->line1 = func_get_arg(9); + $this->line2 = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['complement'] = $this->complement; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + + return $json; + } +} diff --git a/src/Models/Billingaddress3.php b/src/Models/Billingaddress3.php new file mode 100644 index 0000000..9718c1f --- /dev/null +++ b/src/Models/Billingaddress3.php @@ -0,0 +1,215 @@ +id + * @param string $street Initialization value for $this->street + * @param string $number Initialization value for $this->number + * @param string $complement Initialization value for $this->complement + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->street = func_get_arg(1); + $this->number = func_get_arg(2); + $this->complement = func_get_arg(3); + $this->zipCode = func_get_arg(4); + $this->neighborhood = func_get_arg(5); + $this->city = func_get_arg(6); + $this->state = func_get_arg(7); + $this->country = func_get_arg(8); + $this->status = func_get_arg(9); + $this->createdAt = func_get_arg(10); + $this->updatedAt = func_get_arg(11); + $this->customer = func_get_arg(12); + $this->metadata = func_get_arg(13); + $this->line1 = func_get_arg(14); + $this->line2 = func_get_arg(15); + $this->deletedAt = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['complement'] = $this->complement; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/Boleto1.php b/src/Models/Boleto1.php new file mode 100644 index 0000000..af610a4 --- /dev/null +++ b/src/Models/Boleto1.php @@ -0,0 +1,150 @@ +retries + * @param string $bank Initialization value for $this->bank + * @param string $instructions Initialization value for $this->instructions + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param string $nossoNumero Initialization value for $this->nossoNumero + * @param string $documentNumber Initialization value for $this->documentNumber + * @param Interest $interest Initialization value for $this->interest + * @param Fine $fine Initialization value for $this->fine + * @param integer $maxDaysToPayPastDue Initialization value for $this->maxDaysToPayPastDue + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->retries = func_get_arg(0); + $this->bank = func_get_arg(1); + $this->instructions = func_get_arg(2); + $this->dueAt = func_get_arg(3); + $this->billingAddress = func_get_arg(4); + $this->billingAddressId = func_get_arg(5); + $this->nossoNumero = func_get_arg(6); + $this->documentNumber = func_get_arg(7); + $this->interest = func_get_arg(8); + $this->fine = func_get_arg(9); + $this->maxDaysToPayPastDue = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['retries'] = $this->retries; + $json['bank'] = $this->bank; + $json['instructions'] = $this->instructions; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['billing_address'] = $this->billingAddress; + $json['billing_address_id'] = $this->billingAddressId; + $json['nosso_numero'] = $this->nossoNumero; + $json['document_number'] = $this->documentNumber; + $json['interest'] = $this->interest; + $json['fine'] = $this->fine; + $json['max_days_to_pay_past_due'] = $this->maxDaysToPayPastDue; + + return $json; + } +} diff --git a/src/Models/CancelSplitRequest.php b/src/Models/CancelSplitRequest.php index 355b89a..09e81d8 100644 --- a/src/Models/CancelSplitRequest.php +++ b/src/Models/CancelSplitRequest.php @@ -37,8 +37,8 @@ class CancelSplitRequest implements JsonSerializable public $recipientId; /** - * The split options request - * @var \MundiAPILib\Models\CreateSplitOptionsRequest|null $options public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Options2|null $options public property */ public $options; @@ -51,11 +51,11 @@ class CancelSplitRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $type Initialization value for $this->type - * @param integer $amount Initialization value for $this->amount - * @param string $recipientId Initialization value for $this->recipientId - * @param CreateSplitOptionsRequest $options Initialization value for $this->options - * @param string $splitRuleId Initialization value for $this->splitRuleId + * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + * @param string $recipientId Initialization value for $this->recipientId + * @param Options2 $options Initialization value for $this->options + * @param string $splitRuleId Initialization value for $this->splitRuleId */ public function __construct() { diff --git a/src/Models/Card.php b/src/Models/Card.php new file mode 100644 index 0000000..b82d430 --- /dev/null +++ b/src/Models/Card.php @@ -0,0 +1,219 @@ +id + * @param string $lastFourDigits Initialization value for $this->lastFourDigits + * @param string $brand Initialization value for $this->brand + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param string $holderDocument Initialization value for $this->holderDocument + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $firstSixDigits Initialization value for $this->firstSixDigits + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->lastFourDigits = func_get_arg(1); + $this->brand = func_get_arg(2); + $this->holderName = func_get_arg(3); + $this->expMonth = func_get_arg(4); + $this->expYear = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->billingAddress = func_get_arg(9); + $this->customer = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->type = func_get_arg(12); + $this->holderDocument = func_get_arg(13); + $this->deletedAt = func_get_arg(14); + $this->firstSixDigits = func_get_arg(15); + $this->label = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['last_four_digits'] = $this->lastFourDigits; + $json['brand'] = $this->brand; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['billing_address'] = $this->billingAddress; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['type'] = $this->type; + $json['holder_document'] = $this->holderDocument; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['first_six_digits'] = $this->firstSixDigits; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/Card1.php b/src/Models/Card1.php new file mode 100644 index 0000000..839e9be --- /dev/null +++ b/src/Models/Card1.php @@ -0,0 +1,200 @@ +number + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $cvv Initialization value for $this->cvv + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param string $brand Initialization value for $this->brand + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param Options1 $options Initialization value for $this->options + * @param string $holderDocument Initialization value for $this->holderDocument + * @param bool $privateLabel Initialization value for $this->privateLabel + * @param string $label Initialization value for $this->label + * @param string $id Initialization value for $this->id + * @param string $token Initialization value for $this->token + */ + public function __construct() + { + if (16 == func_num_args()) { + $this->number = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->expMonth = func_get_arg(2); + $this->expYear = func_get_arg(3); + $this->cvv = func_get_arg(4); + $this->billingAddress = func_get_arg(5); + $this->brand = func_get_arg(6); + $this->billingAddressId = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->type = func_get_arg(9); + $this->options = func_get_arg(10); + $this->holderDocument = func_get_arg(11); + $this->privateLabel = func_get_arg(12); + $this->label = func_get_arg(13); + $this->id = func_get_arg(14); + $this->token = func_get_arg(15); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['number'] = $this->number; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['cvv'] = $this->cvv; + $json['billing_address'] = $this->billingAddress; + $json['brand'] = $this->brand; + $json['billing_address_id'] = $this->billingAddressId; + $json['metadata'] = $this->metadata; + $json['type'] = $this->type; + $json['options'] = $this->options; + $json['holder_document'] = $this->holderDocument; + $json['private_label'] = $this->privateLabel; + $json['label'] = $this->label; + $json['id'] = $this->id; + $json['token'] = $this->token; + + return $json; + } +} diff --git a/src/Models/Card11.php b/src/Models/Card11.php new file mode 100644 index 0000000..ca3b08d --- /dev/null +++ b/src/Models/Card11.php @@ -0,0 +1,109 @@ +number + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $cvv Initialization value for $this->cvv + * @param string $brand Initialization value for $this->brand + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (7 == func_num_args()) { + $this->number = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->expMonth = func_get_arg(2); + $this->expYear = func_get_arg(3); + $this->cvv = func_get_arg(4); + $this->brand = func_get_arg(5); + $this->label = func_get_arg(6); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['number'] = $this->number; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['cvv'] = $this->cvv; + $json['brand'] = $this->brand; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/Card9.php b/src/Models/Card9.php new file mode 100644 index 0000000..85c746f --- /dev/null +++ b/src/Models/Card9.php @@ -0,0 +1,121 @@ +lastFourDigits + * @param string $holderName Initialization value for $this->holderName + * @param string $holderDocument Initialization value for $this->holderDocument + * @param string $expMonth Initialization value for $this->expMonth + * @param string $expYear Initialization value for $this->expYear + * @param string $brand Initialization value for $this->brand + * @param string $type Initialization value for $this->type + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (8 == func_num_args()) { + $this->lastFourDigits = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->holderDocument = func_get_arg(2); + $this->expMonth = func_get_arg(3); + $this->expYear = func_get_arg(4); + $this->brand = func_get_arg(5); + $this->type = func_get_arg(6); + $this->label = func_get_arg(7); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['last_four_digits'] = $this->lastFourDigits; + $json['holder_name'] = $this->holderName; + $json['holder_document'] = $this->holderDocument; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['brand'] = $this->brand; + $json['type'] = $this->type; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/Charge.php b/src/Models/Charge.php new file mode 100644 index 0000000..899af57 --- /dev/null +++ b/src/Models/Charge.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesCaptureRequest.php b/src/Models/ChargesCaptureRequest.php new file mode 100644 index 0000000..53e43bb --- /dev/null +++ b/src/Models/ChargesCaptureRequest.php @@ -0,0 +1,75 @@ +code + * @param integer $amount Initialization value for $this->amount + * @param array $split Initialization value for $this->split + * @param string $operationReference Initialization value for $this->operationReference + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->code = func_get_arg(0); + $this->amount = func_get_arg(1); + $this->split = func_get_arg(2); + $this->operationReference = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['code'] = $this->code; + $json['amount'] = $this->amount; + $json['split'] = $this->split; + $json['operation_reference'] = $this->operationReference; + + return $json; + } +} diff --git a/src/Models/ChargesCaptureResponse.php b/src/Models/ChargesCaptureResponse.php new file mode 100644 index 0000000..875026f --- /dev/null +++ b/src/Models/ChargesCaptureResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesCardRequest.php b/src/Models/ChargesCardRequest.php new file mode 100644 index 0000000..927983e --- /dev/null +++ b/src/Models/ChargesCardRequest.php @@ -0,0 +1,78 @@ +updateSubscription + * @param string $cardId Initialization value for $this->cardId + * @param Card1 $card Initialization value for $this->card + * @param bool $recurrence Initialization value for $this->recurrence + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->updateSubscription = func_get_arg(0); + $this->cardId = func_get_arg(1); + $this->card = func_get_arg(2); + $this->recurrence = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['update_subscription'] = $this->updateSubscription; + $json['card_id'] = $this->cardId; + $json['card'] = $this->card; + $json['recurrence'] = $this->recurrence; + + return $json; + } +} diff --git a/src/Models/ChargesCardResponse.php b/src/Models/ChargesCardResponse.php new file mode 100644 index 0000000..692e16a --- /dev/null +++ b/src/Models/ChargesCardResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesConfirmPaymentResponse.php b/src/Models/ChargesConfirmPaymentResponse.php new file mode 100644 index 0000000..eb7c19b --- /dev/null +++ b/src/Models/ChargesConfirmPaymentResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesDueDateRequest.php b/src/Models/ChargesDueDateRequest.php new file mode 100644 index 0000000..40722e1 --- /dev/null +++ b/src/Models/ChargesDueDateRequest.php @@ -0,0 +1,49 @@ +dueAt + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->dueAt = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + + return $json; + } +} diff --git a/src/Models/ChargesDueDateResponse.php b/src/Models/ChargesDueDateResponse.php new file mode 100644 index 0000000..2076216 --- /dev/null +++ b/src/Models/ChargesDueDateResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesMetadataRequest.php b/src/Models/ChargesMetadataRequest.php new file mode 100644 index 0000000..fd29f88 --- /dev/null +++ b/src/Models/ChargesMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/ChargesMetadataResponse.php b/src/Models/ChargesMetadataResponse.php new file mode 100644 index 0000000..3f06dfb --- /dev/null +++ b/src/Models/ChargesMetadataResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesPaymentMethodRequest.php b/src/Models/ChargesPaymentMethodRequest.php new file mode 100644 index 0000000..2f6279c --- /dev/null +++ b/src/Models/ChargesPaymentMethodRequest.php @@ -0,0 +1,132 @@ +updateSubscription + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param CreditCard1 $creditCard Initialization value for $this->creditCard + * @param DebitCard1 $debitCard Initialization value for $this->debitCard + * @param Boleto1 $boleto Initialization value for $this->boleto + * @param Voucher $voucher Initialization value for $this->voucher + * @param CreateCashPaymentRequest $cash Initialization value for $this->cash + * @param BankTransfer1 $bankTransfer Initialization value for $this->bankTransfer + * @param PrivateLabel $privateLabel Initialization value for $this->privateLabel + */ + public function __construct() + { + if (9 == func_num_args()) { + $this->updateSubscription = func_get_arg(0); + $this->paymentMethod = func_get_arg(1); + $this->creditCard = func_get_arg(2); + $this->debitCard = func_get_arg(3); + $this->boleto = func_get_arg(4); + $this->voucher = func_get_arg(5); + $this->cash = func_get_arg(6); + $this->bankTransfer = func_get_arg(7); + $this->privateLabel = func_get_arg(8); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['update_subscription'] = $this->updateSubscription; + $json['payment_method'] = $this->paymentMethod; + $json['credit_card'] = $this->creditCard; + $json['debit_card'] = $this->debitCard; + $json['boleto'] = $this->boleto; + $json['voucher'] = $this->voucher; + $json['cash'] = $this->cash; + $json['bank_transfer'] = $this->bankTransfer; + $json['private_label'] = $this->privateLabel; + + return $json; + } +} diff --git a/src/Models/ChargesPaymentMethodResponse.php b/src/Models/ChargesPaymentMethodResponse.php new file mode 100644 index 0000000..f16429a --- /dev/null +++ b/src/Models/ChargesPaymentMethodResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesRequest.php b/src/Models/ChargesRequest.php new file mode 100644 index 0000000..3b2b8e7 --- /dev/null +++ b/src/Models/ChargesRequest.php @@ -0,0 +1,75 @@ +amount + * @param array $splitRules Initialization value for $this->splitRules + * @param array $split Initialization value for $this->split + * @param string $operationReference Initialization value for $this->operationReference + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->splitRules = func_get_arg(1); + $this->split = func_get_arg(2); + $this->operationReference = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['split_rules'] = $this->splitRules; + $json['split'] = $this->split; + $json['operation_reference'] = $this->operationReference; + + return $json; + } +} diff --git a/src/Models/ChargesRequest1.php b/src/Models/ChargesRequest1.php new file mode 100644 index 0000000..1cfc88b --- /dev/null +++ b/src/Models/ChargesRequest1.php @@ -0,0 +1,131 @@ +code + * @param integer $amount Initialization value for $this->amount + * @param string $customerId Initialization value for $this->customerId + * @param Customer8 $customer Initialization value for $this->customer + * @param Payment $payment Initialization value for $this->payment + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param CreateAntifraudRequest $antifraud Initialization value for $this->antifraud + * @param string $orderId Initialization value for $this->orderId + */ + public function __construct() + { + if (9 == func_num_args()) { + $this->code = func_get_arg(0); + $this->amount = func_get_arg(1); + $this->customerId = func_get_arg(2); + $this->customer = func_get_arg(3); + $this->payment = func_get_arg(4); + $this->metadata = func_get_arg(5); + $this->dueAt = func_get_arg(6); + $this->antifraud = func_get_arg(7); + $this->orderId = func_get_arg(8); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['code'] = $this->code; + $json['amount'] = $this->amount; + $json['customer_id'] = $this->customerId; + $json['customer'] = $this->customer; + $json['payment'] = $this->payment; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['antifraud'] = $this->antifraud; + $json['order_id'] = $this->orderId; + + return $json; + } +} diff --git a/src/Models/ChargesResponse.php b/src/Models/ChargesResponse.php new file mode 100644 index 0000000..cb2bf12 --- /dev/null +++ b/src/Models/ChargesResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesResponse2.php b/src/Models/ChargesResponse2.php new file mode 100644 index 0000000..f8f4f78 --- /dev/null +++ b/src/Models/ChargesResponse2.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/ChargesRetryResponse.php b/src/Models/ChargesRetryResponse.php new file mode 100644 index 0000000..e52cccf --- /dev/null +++ b/src/Models/ChargesRetryResponse.php @@ -0,0 +1,258 @@ +id + * @param string $code Initialization value for $this->code + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param integer $canceledAmount Initialization value for $this->canceledAmount + * @param integer $paidAmount Initialization value for $this->paidAmount + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $interestAndFinePaid Initialization value for $this->interestAndFinePaid + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->gatewayId = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->currency = func_get_arg(5); + $this->paymentMethod = func_get_arg(6); + $this->dueAt = func_get_arg(7); + $this->createdAt = func_get_arg(8); + $this->updatedAt = func_get_arg(9); + $this->lastTransaction = func_get_arg(10); + $this->invoice = func_get_arg(11); + $this->order = func_get_arg(12); + $this->customer = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->paidAt = func_get_arg(15); + $this->canceledAt = func_get_arg(16); + $this->canceledAmount = func_get_arg(17); + $this->paidAmount = func_get_arg(18); + $this->recurrencyCycle = func_get_arg(19); + $this->interestAndFinePaid = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['gateway_id'] = $this->gatewayId; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['payment_method'] = $this->paymentMethod; + $json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['last_transaction'] = $this->lastTransaction; + $json['invoice'] = $this->invoice; + $json['order'] = $this->order; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['paid_at'] = isset($this->paidAt) ? + DateTimeHelper::toRfc3339DateTime($this->paidAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['canceled_amount'] = $this->canceledAmount; + $json['paid_amount'] = $this->paidAmount; + $json['recurrency_cycle'] = $this->recurrencyCycle; + $json['interest_and_fine_paid'] = $this->interestAndFinePaid; + + return $json; + } +} diff --git a/src/Models/ChargesTransactionsResponse.php b/src/Models/ChargesTransactionsResponse.php new file mode 100644 index 0000000..7b53f4d --- /dev/null +++ b/src/Models/ChargesTransactionsResponse.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/Checkout.php b/src/Models/Checkout.php new file mode 100644 index 0000000..7f20116 --- /dev/null +++ b/src/Models/Checkout.php @@ -0,0 +1,207 @@ +acceptedPaymentMethods + * @param array $acceptedMultiPaymentMethods Initialization value for $this- + * >acceptedMultiPaymentMethods + * @param string $successUrl Initialization value for $this- + * >successUrl + * @param string $defaultPaymentMethod Initialization value for $this- + * >defaultPaymentMethod + * @param string $gatewayAffiliationId Initialization value for $this- + * >gatewayAffiliationId + * @param CreditCard2 $creditCard Initialization value for $this- + * >creditCard + * @param DebitCard2 $debitCard Initialization value for $this- + * >debitCard + * @param CreateCheckoutBoletoPaymentRequest $boleto Initialization value for $this->boleto + * @param bool $customerEditable Initialization value for $this- + * >customerEditable + * @param integer $expiresIn Initialization value for $this- + * >expiresIn + * @param bool $skipCheckoutSuccessPage Initialization value for $this- + * >skipCheckoutSuccessPage + * @param bool $billingAddressEditable Initialization value for $this- + * >billingAddressEditable + * @param BillingAddress1 $billingAddress Initialization value for $this- + * >billingAddress + * @param BankTransfer2 $bankTransfer Initialization value for $this- + * >bankTransfer + * @param array $acceptedBrands Initialization value for $this- + * >acceptedBrands + */ + public function __construct() + { + if (15 == func_num_args()) { + $this->acceptedPaymentMethods = func_get_arg(0); + $this->acceptedMultiPaymentMethods = func_get_arg(1); + $this->successUrl = func_get_arg(2); + $this->defaultPaymentMethod = func_get_arg(3); + $this->gatewayAffiliationId = func_get_arg(4); + $this->creditCard = func_get_arg(5); + $this->debitCard = func_get_arg(6); + $this->boleto = func_get_arg(7); + $this->customerEditable = func_get_arg(8); + $this->expiresIn = func_get_arg(9); + $this->skipCheckoutSuccessPage = func_get_arg(10); + $this->billingAddressEditable = func_get_arg(11); + $this->billingAddress = func_get_arg(12); + $this->bankTransfer = func_get_arg(13); + $this->acceptedBrands = func_get_arg(14); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['accepted_payment_methods'] = $this->acceptedPaymentMethods; + $json['accepted_multi_payment_methods'] = $this->acceptedMultiPaymentMethods; + $json['success_url'] = $this->successUrl; + $json['default_payment_method'] = $this->defaultPaymentMethod; + $json['gateway_affiliation_id'] = $this->gatewayAffiliationId; + $json['credit_card'] = $this->creditCard; + $json['debit_card'] = $this->debitCard; + $json['boleto'] = $this->boleto; + $json['customer_editable'] = $this->customerEditable; + $json['expires_in'] = $this->expiresIn; + $json['skip_checkout_success_page'] = $this->skipCheckoutSuccessPage; + $json['billing_address_editable'] = $this->billingAddressEditable; + $json['billing_address'] = $this->billingAddress; + $json['bank_transfer'] = $this->bankTransfer; + $json['accepted_brands'] = $this->acceptedBrands; + + return $json; + } +} diff --git a/src/Models/Contactless.php b/src/Models/Contactless.php new file mode 100644 index 0000000..aa3183e --- /dev/null +++ b/src/Models/Contactless.php @@ -0,0 +1,75 @@ +type + * @param ApplePay $applePay Initialization value for $this->applePay + * @param GooglePay $googlePay Initialization value for $this->googlePay + * @param CreateEmvDecryptRequest $emv Initialization value for $this->emv + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->type = func_get_arg(0); + $this->applePay = func_get_arg(1); + $this->googlePay = func_get_arg(2); + $this->emv = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['apple_pay'] = $this->applePay; + $json['google_pay'] = $this->googlePay; + $json['emv'] = $this->emv; + + return $json; + } +} diff --git a/src/Models/CreateApplePayRequest.php b/src/Models/CreateApplePayRequest.php index 13c3e55..fd1047a 100644 --- a/src/Models/CreateApplePayRequest.php +++ b/src/Models/CreateApplePayRequest.php @@ -29,9 +29,9 @@ class CreateApplePayRequest implements JsonSerializable public $data; /** - * The ApplePay header request + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateApplePayHeaderRequest $header public property + * @var \MundiAPILib\Models\Header $header public property */ public $header; @@ -52,11 +52,11 @@ class CreateApplePayRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $version Initialization value for $this->version - * @param string $data Initialization value for $this->data - * @param CreateApplePayHeaderRequest $header Initialization value for $this->header - * @param string $signature Initialization value for $this->signature - * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier + * @param string $version Initialization value for $this->version + * @param string $data Initialization value for $this->data + * @param Header $header Initialization value for $this->header + * @param string $signature Initialization value for $this->signature + * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier */ public function __construct() { diff --git a/src/Models/CreateBoletoPaymentRequest.php b/src/Models/CreateBoletoPaymentRequest.php index 73584ee..a45a210 100644 --- a/src/Models/CreateBoletoPaymentRequest.php +++ b/src/Models/CreateBoletoPaymentRequest.php @@ -45,10 +45,10 @@ class CreateBoletoPaymentRequest implements JsonSerializable public $dueAt; /** - * Card's billing address + * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\CreateAddressRequest $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress1 $billingAddress public property */ public $billingAddress; @@ -77,13 +77,13 @@ class CreateBoletoPaymentRequest implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\CreateInterestRequest|null $interest public property + * @var \MundiAPILib\Models\Interest|null $interest public property */ public $interest; /** * @todo Write general description for this property - * @var \MundiAPILib\Models\CreateFineRequest|null $fine public property + * @var \MundiAPILib\Models\Fine|null $fine public property */ public $fine; @@ -96,17 +96,17 @@ class CreateBoletoPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $retries Initialization value for $this->retries - * @param string $bank Initialization value for $this->bank - * @param string $instructions Initialization value for $this->instructions - * @param \DateTime $dueAt Initialization value for $this->dueAt - * @param CreateAddressRequest $billingAddress Initialization value for $this->billingAddress - * @param string $billingAddressId Initialization value for $this->billingAddressId - * @param string $nossoNumero Initialization value for $this->nossoNumero - * @param string $documentNumber Initialization value for $this->documentNumber - * @param CreateInterestRequest $interest Initialization value for $this->interest - * @param CreateFineRequest $fine Initialization value for $this->fine - * @param integer $maxDaysToPayPastDue Initialization value for $this->maxDaysToPayPastDue + * @param integer $retries Initialization value for $this->retries + * @param string $bank Initialization value for $this->bank + * @param string $instructions Initialization value for $this->instructions + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param string $nossoNumero Initialization value for $this->nossoNumero + * @param string $documentNumber Initialization value for $this->documentNumber + * @param Interest $interest Initialization value for $this->interest + * @param Fine $fine Initialization value for $this->fine + * @param integer $maxDaysToPayPastDue Initialization value for $this->maxDaysToPayPastDue */ public function __construct() { diff --git a/src/Models/CreateCancelSubscriptionRequest.php b/src/Models/CreateCancelSubscriptionRequest.php index 077697f..fd91bd4 100644 --- a/src/Models/CreateCancelSubscriptionRequest.php +++ b/src/Models/CreateCancelSubscriptionRequest.php @@ -28,14 +28,8 @@ class CreateCancelSubscriptionRequest implements JsonSerializable */ public function __construct() { - switch (func_num_args()) { - case 1: - $this->cancelPendingInvoices = func_get_arg(0); - break; - - default: - $this->cancelPendingInvoices = true; - break; + if (1 == func_num_args()) { + $this->cancelPendingInvoices = func_get_arg(0); } } diff --git a/src/Models/CreateCardPaymentContactlessRequest.php b/src/Models/CreateCardPaymentContactlessRequest.php index 983546a..e091c5f 100644 --- a/src/Models/CreateCardPaymentContactlessRequest.php +++ b/src/Models/CreateCardPaymentContactlessRequest.php @@ -22,21 +22,21 @@ class CreateCardPaymentContactlessRequest implements JsonSerializable public $type; /** - * The ApplePay encrypted request + * @todo Write general description for this property * @maps apple_pay - * @var \MundiAPILib\Models\CreateApplePayRequest|null $applePay public property + * @var \MundiAPILib\Models\ApplePay|null $applePay public property */ public $applePay; /** - * The GooglePay encrypted request + * @todo Write general description for this property * @maps google_pay - * @var \MundiAPILib\Models\CreateGooglePayRequest|null $googlePay public property + * @var \MundiAPILib\Models\GooglePay|null $googlePay public property */ public $googlePay; /** - * The Emv encrypted request + * @todo Write general description for this property * @var \MundiAPILib\Models\CreateEmvDecryptRequest|null $emv public property */ public $emv; @@ -44,8 +44,8 @@ class CreateCardPaymentContactlessRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties * @param string $type Initialization value for $this->type - * @param CreateApplePayRequest $applePay Initialization value for $this->applePay - * @param CreateGooglePayRequest $googlePay Initialization value for $this->googlePay + * @param ApplePay $applePay Initialization value for $this->applePay + * @param GooglePay $googlePay Initialization value for $this->googlePay * @param CreateEmvDecryptRequest $emv Initialization value for $this->emv */ public function __construct() diff --git a/src/Models/CreateCardRequest.php b/src/Models/CreateCardRequest.php index 9f52af5..f8c0b40 100644 --- a/src/Models/CreateCardRequest.php +++ b/src/Models/CreateCardRequest.php @@ -53,10 +53,10 @@ class CreateCardRequest implements JsonSerializable public $cvv; /** - * Card's billing address + * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\CreateAddressRequest $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress1 $billingAddress public property */ public $billingAddress; @@ -90,9 +90,9 @@ class CreateCardRequest implements JsonSerializable public $type; /** - * Options for creating the card + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardOptionsRequest $options public property + * @var \MundiAPILib\Models\Options1 $options public property */ public $options; @@ -132,48 +132,42 @@ class CreateCardRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $number Initialization value for $this->number - * @param string $holderName Initialization value for $this->holderName - * @param integer $expMonth Initialization value for $this->expMonth - * @param integer $expYear Initialization value for $this->expYear - * @param string $cvv Initialization value for $this->cvv - * @param CreateAddressRequest $billingAddress Initialization value for $this->billingAddress - * @param string $brand Initialization value for $this->brand - * @param string $billingAddressId Initialization value for $this->billingAddressId - * @param array $metadata Initialization value for $this->metadata - * @param string $type Initialization value for $this->type - * @param CreateCardOptionsRequest $options Initialization value for $this->options - * @param string $holderDocument Initialization value for $this->holderDocument - * @param bool $privateLabel Initialization value for $this->privateLabel - * @param string $label Initialization value for $this->label - * @param string $id Initialization value for $this->id - * @param string $token Initialization value for $this->token + * @param string $number Initialization value for $this->number + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $cvv Initialization value for $this->cvv + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param string $brand Initialization value for $this->brand + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param Options1 $options Initialization value for $this->options + * @param string $holderDocument Initialization value for $this->holderDocument + * @param bool $privateLabel Initialization value for $this->privateLabel + * @param string $label Initialization value for $this->label + * @param string $id Initialization value for $this->id + * @param string $token Initialization value for $this->token */ public function __construct() { - switch (func_num_args()) { - case 16: - $this->number = func_get_arg(0); - $this->holderName = func_get_arg(1); - $this->expMonth = func_get_arg(2); - $this->expYear = func_get_arg(3); - $this->cvv = func_get_arg(4); - $this->billingAddress = func_get_arg(5); - $this->brand = func_get_arg(6); - $this->billingAddressId = func_get_arg(7); - $this->metadata = func_get_arg(8); - $this->type = func_get_arg(9); - $this->options = func_get_arg(10); - $this->holderDocument = func_get_arg(11); - $this->privateLabel = func_get_arg(12); - $this->label = func_get_arg(13); - $this->id = func_get_arg(14); - $this->token = func_get_arg(15); - break; - - default: - $this->type = 'credit'; - break; + if (16 == func_num_args()) { + $this->number = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->expMonth = func_get_arg(2); + $this->expYear = func_get_arg(3); + $this->cvv = func_get_arg(4); + $this->billingAddress = func_get_arg(5); + $this->brand = func_get_arg(6); + $this->billingAddressId = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->type = func_get_arg(9); + $this->options = func_get_arg(10); + $this->holderDocument = func_get_arg(11); + $this->privateLabel = func_get_arg(12); + $this->label = func_get_arg(13); + $this->id = func_get_arg(14); + $this->token = func_get_arg(15); } } diff --git a/src/Models/CreateChargeRequest.php b/src/Models/CreateChargeRequest.php index c4153f5..1f177fb 100644 --- a/src/Models/CreateChargeRequest.php +++ b/src/Models/CreateChargeRequest.php @@ -38,16 +38,16 @@ class CreateChargeRequest implements JsonSerializable public $customerId; /** - * Customer data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCustomerRequest $customer public property + * @var \MundiAPILib\Models\Customer8 $customer public property */ public $customer; /** - * Payment data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreatePaymentRequest $payment public property + * @var \MundiAPILib\Models\Payment $payment public property */ public $payment; @@ -86,8 +86,8 @@ class CreateChargeRequest implements JsonSerializable * @param string $code Initialization value for $this->code * @param integer $amount Initialization value for $this->amount * @param string $customerId Initialization value for $this->customerId - * @param CreateCustomerRequest $customer Initialization value for $this->customer - * @param CreatePaymentRequest $payment Initialization value for $this->payment + * @param Customer8 $customer Initialization value for $this->customer + * @param Payment $payment Initialization value for $this->payment * @param array $metadata Initialization value for $this->metadata * @param \DateTime $dueAt Initialization value for $this->dueAt * @param CreateAntifraudRequest $antifraud Initialization value for $this->antifraud diff --git a/src/Models/CreateCheckoutCreditCardPaymentRequest.php b/src/Models/CreateCheckoutCreditCardPaymentRequest.php index 411c458..bf2ce3f 100644 --- a/src/Models/CreateCheckoutCreditCardPaymentRequest.php +++ b/src/Models/CreateCheckoutCreditCardPaymentRequest.php @@ -28,8 +28,8 @@ class CreateCheckoutCreditCardPaymentRequest implements JsonSerializable public $installments; /** - * Creates payment authentication - * @var \MundiAPILib\Models\CreatePaymentAuthenticationRequest|null $authentication public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Authentication2|null $authentication public property */ public $authentication; @@ -41,11 +41,10 @@ class CreateCheckoutCreditCardPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param array $installments Initialization value for $this->installments - * @param CreatePaymentAuthenticationRequest $authentication Initialization value for $this->authentication - * @param bool $capture Initialization value for $this->capture + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param array $installments Initialization value for $this->installments + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param bool $capture Initialization value for $this->capture */ public function __construct() { diff --git a/src/Models/CreateCheckoutDebitCardPaymentRequest.php b/src/Models/CreateCheckoutDebitCardPaymentRequest.php index 6420f4c..1918d05 100644 --- a/src/Models/CreateCheckoutDebitCardPaymentRequest.php +++ b/src/Models/CreateCheckoutDebitCardPaymentRequest.php @@ -22,17 +22,16 @@ class CreateCheckoutDebitCardPaymentRequest implements JsonSerializable public $statementDescriptor; /** - * Creates payment authentication + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreatePaymentAuthenticationRequest $authentication public property + * @var \MundiAPILib\Models\Authentication2 $authentication public property */ public $authentication; /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param CreatePaymentAuthenticationRequest $authentication Initialization value for $this->authentication + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Authentication2 $authentication Initialization value for $this->authentication */ public function __construct() { diff --git a/src/Models/CreateCheckoutPaymentRequest.php b/src/Models/CreateCheckoutPaymentRequest.php index c605e31..4922693 100644 --- a/src/Models/CreateCheckoutPaymentRequest.php +++ b/src/Models/CreateCheckoutPaymentRequest.php @@ -53,21 +53,21 @@ class CreateCheckoutPaymentRequest implements JsonSerializable public $gatewayAffiliationId; /** - * Credit Card payment request + * @todo Write general description for this property * @maps credit_card - * @var \MundiAPILib\Models\CreateCheckoutCreditCardPaymentRequest|null $creditCard public property + * @var \MundiAPILib\Models\CreditCard2|null $creditCard public property */ public $creditCard; /** - * Debit Card payment request + * @todo Write general description for this property * @maps debit_card - * @var \MundiAPILib\Models\CreateCheckoutDebitCardPaymentRequest|null $debitCard public property + * @var \MundiAPILib\Models\DebitCard2|null $debitCard public property */ public $debitCard; /** - * Boleto payment request + * @todo Write general description for this property * @var \MundiAPILib\Models\CreateCheckoutBoletoPaymentRequest|null $boleto public property */ public $boleto; @@ -103,18 +103,18 @@ class CreateCheckoutPaymentRequest implements JsonSerializable public $billingAddressEditable; /** - * Billing Address + * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\CreateAddressRequest $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress1 $billingAddress public property */ public $billingAddress; /** - * Bank Transfer payment request + * @todo Write general description for this property * @required * @maps bank_transfer - * @var \MundiAPILib\Models\CreateCheckoutBankTransferRequest $bankTransfer public property + * @var \MundiAPILib\Models\BankTransfer2 $bankTransfer public property */ public $bankTransfer; @@ -128,36 +128,35 @@ class CreateCheckoutPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param array $acceptedPaymentMethods Initialization value for $this- - * >acceptedPaymentMethods - * @param array $acceptedMultiPaymentMethods Initialization value for $this- - * >acceptedMultiPaymentMethods - * @param string $successUrl Initialization value for $this- - * >successUrl - * @param string $defaultPaymentMethod Initialization value for $this- - * >defaultPaymentMethod - * @param string $gatewayAffiliationId Initialization value for $this- - * >gatewayAffiliationId - * @param CreateCheckoutCreditCardPaymentRequest $creditCard Initialization value for $this- - * >creditCard - * @param CreateCheckoutDebitCardPaymentRequest $debitCard Initialization value for $this- - * >debitCard - * @param CreateCheckoutBoletoPaymentRequest $boleto Initialization value for $this- - * >boleto - * @param bool $customerEditable Initialization value for $this- - * >customerEditable - * @param integer $expiresIn Initialization value for $this- - * >expiresIn - * @param bool $skipCheckoutSuccessPage Initialization value for $this- - * >skipCheckoutSuccessPage - * @param bool $billingAddressEditable Initialization value for $this- - * >billingAddressEditable - * @param CreateAddressRequest $billingAddress Initialization value for $this- - * >billingAddress - * @param CreateCheckoutBankTransferRequest $bankTransfer Initialization value for $this- - * >bankTransfer - * @param array $acceptedBrands Initialization value for $this- - * >acceptedBrands + * @param array $acceptedPaymentMethods Initialization value for $this- + * >acceptedPaymentMethods + * @param array $acceptedMultiPaymentMethods Initialization value for $this- + * >acceptedMultiPaymentMethods + * @param string $successUrl Initialization value for $this- + * >successUrl + * @param string $defaultPaymentMethod Initialization value for $this- + * >defaultPaymentMethod + * @param string $gatewayAffiliationId Initialization value for $this- + * >gatewayAffiliationId + * @param CreditCard2 $creditCard Initialization value for $this- + * >creditCard + * @param DebitCard2 $debitCard Initialization value for $this- + * >debitCard + * @param CreateCheckoutBoletoPaymentRequest $boleto Initialization value for $this->boleto + * @param bool $customerEditable Initialization value for $this- + * >customerEditable + * @param integer $expiresIn Initialization value for $this- + * >expiresIn + * @param bool $skipCheckoutSuccessPage Initialization value for $this- + * >skipCheckoutSuccessPage + * @param bool $billingAddressEditable Initialization value for $this- + * >billingAddressEditable + * @param BillingAddress1 $billingAddress Initialization value for $this- + * >billingAddress + * @param BankTransfer2 $bankTransfer Initialization value for $this- + * >bankTransfer + * @param array $acceptedBrands Initialization value for $this- + * >acceptedBrands */ public function __construct() { diff --git a/src/Models/CreateCreditCardPaymentRequest.php b/src/Models/CreateCreditCardPaymentRequest.php index 17ea83c..d2390bf 100644 --- a/src/Models/CreateCreditCardPaymentRequest.php +++ b/src/Models/CreateCreditCardPaymentRequest.php @@ -28,8 +28,8 @@ class CreateCreditCardPaymentRequest implements JsonSerializable public $statementDescriptor; /** - * Credit card data - * @var \MundiAPILib\Models\CreateCardRequest|null $card public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Card1|null $card public property */ public $card; @@ -81,14 +81,14 @@ class CreateCreditCardPaymentRequest implements JsonSerializable public $merchantCategoryCode; /** - * The payment authentication request - * @var \MundiAPILib\Models\CreatePaymentAuthenticationRequest|null $authentication public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Authentication2|null $authentication public property */ public $authentication; /** - * The Credit card payment contactless request - * @var \MundiAPILib\Models\CreateCardPaymentContactlessRequest|null $contactless public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Contactless|null $contactless public property */ public $contactless; @@ -115,27 +115,21 @@ class CreateCreditCardPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $installments Initialization value for $this->installments - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $cardId Initialization value for $this->cardId - * @param string $cardToken Initialization value for $this->cardToken - * @param bool $recurrence Initialization value for $this->recurrence - * @param bool $capture Initialization value for $this->capture - * @param bool $extendedLimitEnabled Initialization value for $this- - * >extendedLimitEnabled - * @param string $extendedLimitCode Initialization value for $this- - * >extendedLimitCode - * @param integer $merchantCategoryCode Initialization value for $this- - * >merchantCategoryCode - * @param CreatePaymentAuthenticationRequest $authentication Initialization value for $this- - * >authentication - * @param CreateCardPaymentContactlessRequest $contactless Initialization value for $this->contactless - * @param bool $autoRecovery Initialization value for $this->autoRecovery - * @param string $operationType Initialization value for $this->operationType - * @param string $recurrencyCycle Initialization value for $this- - * >recurrencyCycle + * @param integer $installments Initialization value for $this->installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param bool $capture Initialization value for $this->capture + * @param bool $extendedLimitEnabled Initialization value for $this->extendedLimitEnabled + * @param string $extendedLimitCode Initialization value for $this->extendedLimitCode + * @param integer $merchantCategoryCode Initialization value for $this->merchantCategoryCode + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param Contactless $contactless Initialization value for $this->contactless + * @param bool $autoRecovery Initialization value for $this->autoRecovery + * @param string $operationType Initialization value for $this->operationType + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle */ public function __construct() { diff --git a/src/Models/CreateCustomerRequest.php b/src/Models/CreateCustomerRequest.php index 44ca49e..cef6776 100644 --- a/src/Models/CreateCustomerRequest.php +++ b/src/Models/CreateCustomerRequest.php @@ -43,9 +43,9 @@ class CreateCustomerRequest implements JsonSerializable public $type; /** - * The customer's address + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateAddressRequest $address public property + * @var \MundiAPILib\Models\Address1 $address public property */ public $address; @@ -85,16 +85,16 @@ class CreateCustomerRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $email Initialization value for $this->email - * @param string $document Initialization value for $this->document - * @param string $type Initialization value for $this->type - * @param CreateAddressRequest $address Initialization value for $this->address - * @param array $metadata Initialization value for $this->metadata - * @param CreatePhonesRequest $phones Initialization value for $this->phones - * @param string $code Initialization value for $this->code - * @param string $gender Initialization value for $this->gender - * @param string $documentType Initialization value for $this->documentType + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param Address1 $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param CreatePhonesRequest $phones Initialization value for $this->phones + * @param string $code Initialization value for $this->code + * @param string $gender Initialization value for $this->gender + * @param string $documentType Initialization value for $this->documentType */ public function __construct() { diff --git a/src/Models/CreateDebitCardPaymentRequest.php b/src/Models/CreateDebitCardPaymentRequest.php index d997aba..032d5c1 100644 --- a/src/Models/CreateDebitCardPaymentRequest.php +++ b/src/Models/CreateDebitCardPaymentRequest.php @@ -22,8 +22,8 @@ class CreateDebitCardPaymentRequest implements JsonSerializable public $statementDescriptor; /** - * Debit card data - * @var \MundiAPILib\Models\CreateCardRequest|null $card public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Card1|null $card public property */ public $card; @@ -48,14 +48,14 @@ class CreateDebitCardPaymentRequest implements JsonSerializable public $recurrence; /** - * The payment authentication request - * @var \MundiAPILib\Models\CreatePaymentAuthenticationRequest|null $authentication public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Authentication2|null $authentication public property */ public $authentication; /** - * The Debit card payment token request - * @var \MundiAPILib\Models\CreateCardPaymentContactlessRequest|null $token public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Token|null $token public property */ public $token; @@ -68,16 +68,14 @@ class CreateDebitCardPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $cardId Initialization value for $this->cardId - * @param string $cardToken Initialization value for $this->cardToken - * @param bool $recurrence Initialization value for $this->recurrence - * @param CreatePaymentAuthenticationRequest $authentication Initialization value for $this->authentication - * @param CreateCardPaymentContactlessRequest $token Initialization value for $this->token - * @param string $recurrencyCycle Initialization value for $this- - * >recurrencyCycle + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param Token $token Initialization value for $this->token + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle */ public function __construct() { diff --git a/src/Models/CreateEmvDataDecryptRequest.php b/src/Models/CreateEmvDataDecryptRequest.php index 760efed..7b71de2 100644 --- a/src/Models/CreateEmvDataDecryptRequest.php +++ b/src/Models/CreateEmvDataDecryptRequest.php @@ -22,7 +22,7 @@ class CreateEmvDataDecryptRequest implements JsonSerializable public $cipher; /** - * Dukpt data request + * @todo Write general description for this property * @var \MundiAPILib\Models\CreateEmvDataDukptDecryptRequest|null $dukpt public property */ public $dukpt; diff --git a/src/Models/CreateGooglePayRequest.php b/src/Models/CreateGooglePayRequest.php index e257880..5015935 100644 --- a/src/Models/CreateGooglePayRequest.php +++ b/src/Models/CreateGooglePayRequest.php @@ -29,9 +29,9 @@ class CreateGooglePayRequest implements JsonSerializable public $data; /** - * The GooglePay header request + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateGooglePayHeaderRequest $header public property + * @var \MundiAPILib\Models\Header1 $header public property */ public $header; @@ -52,11 +52,11 @@ class CreateGooglePayRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $version Initialization value for $this->version - * @param string $data Initialization value for $this->data - * @param CreateGooglePayHeaderRequest $header Initialization value for $this->header - * @param string $signature Initialization value for $this->signature - * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier + * @param string $version Initialization value for $this->version + * @param string $data Initialization value for $this->data + * @param Header1 $header Initialization value for $this->header + * @param string $signature Initialization value for $this->signature + * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier */ public function __construct() { diff --git a/src/Models/CreateOrderRequest.php b/src/Models/CreateOrderRequest.php index ba70660..b0442b1 100644 --- a/src/Models/CreateOrderRequest.php +++ b/src/Models/CreateOrderRequest.php @@ -22,9 +22,9 @@ class CreateOrderRequest implements JsonSerializable public $items; /** - * Customer + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCustomerRequest $customer public property + * @var \MundiAPILib\Models\Customer8 $customer public property */ public $customer; @@ -51,8 +51,8 @@ class CreateOrderRequest implements JsonSerializable public $customerId; /** - * Shipping data - * @var \MundiAPILib\Models\CreateShippingRequest|null $shipping public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Shipping3|null $shipping public property */ public $shipping; @@ -84,14 +84,14 @@ class CreateOrderRequest implements JsonSerializable public $sessionId; /** - * Request's location - * @var \MundiAPILib\Models\CreateLocationRequest|null $location public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Location|null $location public property */ public $location; /** - * Device's informations - * @var \MundiAPILib\Models\CreateDeviceRequest|null $device public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Device1|null $device public property */ public $device; @@ -115,55 +115,49 @@ class CreateOrderRequest implements JsonSerializable public $antifraud; /** - * SubMerchant - * @var \MundiAPILib\Models\CreateSubMerchantRequest|null $submerchant public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Submerchant|null $submerchant public property */ public $submerchant; /** * Constructor to set initial or default values of member properties - * @param array $items Initialization value for $this->items - * @param CreateCustomerRequest $customer Initialization value for $this->customer - * @param array $payments Initialization value for $this->payments - * @param string $code Initialization value for $this->code - * @param string $customerId Initialization value for $this->customerId - * @param CreateShippingRequest $shipping Initialization value for $this->shipping - * @param array $metadata Initialization value for $this->metadata - * @param bool $antifraudEnabled Initialization value for $this->antifraudEnabled - * @param string $ip Initialization value for $this->ip - * @param string $sessionId Initialization value for $this->sessionId - * @param CreateLocationRequest $location Initialization value for $this->location - * @param CreateDeviceRequest $device Initialization value for $this->device - * @param bool $closed Initialization value for $this->closed - * @param string $currency Initialization value for $this->currency - * @param CreateAntifraudRequest $antifraud Initialization value for $this->antifraud - * @param CreateSubMerchantRequest $submerchant Initialization value for $this->submerchant + * @param array $items Initialization value for $this->items + * @param Customer8 $customer Initialization value for $this->customer + * @param array $payments Initialization value for $this->payments + * @param string $code Initialization value for $this->code + * @param string $customerId Initialization value for $this->customerId + * @param Shipping3 $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param bool $antifraudEnabled Initialization value for $this->antifraudEnabled + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device1 $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + * @param string $currency Initialization value for $this->currency + * @param CreateAntifraudRequest $antifraud Initialization value for $this->antifraud + * @param Submerchant $submerchant Initialization value for $this->submerchant */ public function __construct() { - switch (func_num_args()) { - case 16: - $this->items = func_get_arg(0); - $this->customer = func_get_arg(1); - $this->payments = func_get_arg(2); - $this->code = func_get_arg(3); - $this->customerId = func_get_arg(4); - $this->shipping = func_get_arg(5); - $this->metadata = func_get_arg(6); - $this->antifraudEnabled = func_get_arg(7); - $this->ip = func_get_arg(8); - $this->sessionId = func_get_arg(9); - $this->location = func_get_arg(10); - $this->device = func_get_arg(11); - $this->closed = func_get_arg(12); - $this->currency = func_get_arg(13); - $this->antifraud = func_get_arg(14); - $this->submerchant = func_get_arg(15); - break; - - default: - $this->closed = true; - break; + if (16 == func_num_args()) { + $this->items = func_get_arg(0); + $this->customer = func_get_arg(1); + $this->payments = func_get_arg(2); + $this->code = func_get_arg(3); + $this->customerId = func_get_arg(4); + $this->shipping = func_get_arg(5); + $this->metadata = func_get_arg(6); + $this->antifraudEnabled = func_get_arg(7); + $this->ip = func_get_arg(8); + $this->sessionId = func_get_arg(9); + $this->location = func_get_arg(10); + $this->device = func_get_arg(11); + $this->closed = func_get_arg(12); + $this->currency = func_get_arg(13); + $this->antifraud = func_get_arg(14); + $this->submerchant = func_get_arg(15); } } diff --git a/src/Models/CreatePaymentAuthenticationRequest.php b/src/Models/CreatePaymentAuthenticationRequest.php index 10ef213..099222c 100644 --- a/src/Models/CreatePaymentAuthenticationRequest.php +++ b/src/Models/CreatePaymentAuthenticationRequest.php @@ -22,17 +22,17 @@ class CreatePaymentAuthenticationRequest implements JsonSerializable public $type; /** - * The 3D-S authentication object + * @todo Write general description for this property * @required * @maps threed_secure - * @var \MundiAPILib\Models\CreateThreeDSecureRequest $threedSecure public property + * @var \MundiAPILib\Models\ThreedSecure1 $threedSecure public property */ public $threedSecure; /** * Constructor to set initial or default values of member properties - * @param string $type Initialization value for $this->type - * @param CreateThreeDSecureRequest $threedSecure Initialization value for $this->threedSecure + * @param string $type Initialization value for $this->type + * @param ThreedSecure1 $threedSecure Initialization value for $this->threedSecure */ public function __construct() { diff --git a/src/Models/CreatePaymentRequest.php b/src/Models/CreatePaymentRequest.php index 8efbad8..3170c6b 100644 --- a/src/Models/CreatePaymentRequest.php +++ b/src/Models/CreatePaymentRequest.php @@ -23,22 +23,22 @@ class CreatePaymentRequest implements JsonSerializable public $paymentMethod; /** - * Settings for credit card payment + * @todo Write general description for this property * @maps credit_card - * @var \MundiAPILib\Models\CreateCreditCardPaymentRequest|null $creditCard public property + * @var \MundiAPILib\Models\CreditCard1|null $creditCard public property */ public $creditCard; /** - * Settings for debit card payment + * @todo Write general description for this property * @maps debit_card - * @var \MundiAPILib\Models\CreateDebitCardPaymentRequest|null $debitCard public property + * @var \MundiAPILib\Models\DebitCard1|null $debitCard public property */ public $debitCard; /** - * Settings for boleto payment - * @var \MundiAPILib\Models\CreateBoletoPaymentRequest|null $boleto public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Boleto1|null $boleto public property */ public $boleto; @@ -49,8 +49,8 @@ class CreatePaymentRequest implements JsonSerializable public $currency; /** - * Settings for voucher payment - * @var \MundiAPILib\Models\CreateVoucherPaymentRequest|null $voucher public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Voucher|null $voucher public property */ public $voucher; @@ -61,9 +61,9 @@ class CreatePaymentRequest implements JsonSerializable public $split; /** - * Settings for bank transfer payment + * @todo Write general description for this property * @maps bank_transfer - * @var \MundiAPILib\Models\CreateBankTransferPaymentRequest|null $bankTransfer public property + * @var \MundiAPILib\Models\BankTransfer1|null $bankTransfer public property */ public $bankTransfer; @@ -81,8 +81,8 @@ class CreatePaymentRequest implements JsonSerializable public $amount; /** - * Settings for checkout payment - * @var \MundiAPILib\Models\CreateCheckoutPaymentRequest|null $checkout public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Checkout|null $checkout public property */ public $checkout; @@ -94,8 +94,8 @@ class CreatePaymentRequest implements JsonSerializable public $customerId; /** - * Customer - * @var \MundiAPILib\Models\CreateCustomerRequest|null $customer public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Customer8|null $customer public property */ public $customer; @@ -106,45 +106,44 @@ class CreatePaymentRequest implements JsonSerializable public $metadata; /** - * Settings for cash payment + * @todo Write general description for this property * @var \MundiAPILib\Models\CreateCashPaymentRequest|null $cash public property */ public $cash; /** - * Settings for private label payment + * @todo Write general description for this property * @required * @maps private_label - * @var \MundiAPILib\Models\CreatePrivateLabelPaymentRequest $privateLabel public property + * @var \MundiAPILib\Models\PrivateLabel $privateLabel public property */ public $privateLabel; /** - * Settings for pix payment - * @var \MundiAPILib\Models\CreatePixPaymentRequest|null $pix public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Pix|null $pix public property */ public $pix; /** * Constructor to set initial or default values of member properties - * @param string $paymentMethod Initialization value for $this->paymentMethod - * @param CreateCreditCardPaymentRequest $creditCard Initialization value for $this->creditCard - * @param CreateDebitCardPaymentRequest $debitCard Initialization value for $this->debitCard - * @param CreateBoletoPaymentRequest $boleto Initialization value for $this->boleto - * @param string $currency Initialization value for $this->currency - * @param CreateVoucherPaymentRequest $voucher Initialization value for $this->voucher - * @param array $split Initialization value for $this->split - * @param CreateBankTransferPaymentRequest $bankTransfer Initialization value for $this->bankTransfer - * @param string $gatewayAffiliationId Initialization value for $this- - * >gatewayAffiliationId - * @param integer $amount Initialization value for $this->amount - * @param CreateCheckoutPaymentRequest $checkout Initialization value for $this->checkout - * @param string $customerId Initialization value for $this->customerId - * @param CreateCustomerRequest $customer Initialization value for $this->customer - * @param array $metadata Initialization value for $this->metadata - * @param CreateCashPaymentRequest $cash Initialization value for $this->cash - * @param CreatePrivateLabelPaymentRequest $privateLabel Initialization value for $this->privateLabel - * @param CreatePixPaymentRequest $pix Initialization value for $this->pix + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param CreditCard1 $creditCard Initialization value for $this->creditCard + * @param DebitCard1 $debitCard Initialization value for $this->debitCard + * @param Boleto1 $boleto Initialization value for $this->boleto + * @param string $currency Initialization value for $this->currency + * @param Voucher $voucher Initialization value for $this->voucher + * @param array $split Initialization value for $this->split + * @param BankTransfer1 $bankTransfer Initialization value for $this->bankTransfer + * @param string $gatewayAffiliationId Initialization value for $this->gatewayAffiliationId + * @param integer $amount Initialization value for $this->amount + * @param Checkout $checkout Initialization value for $this->checkout + * @param string $customerId Initialization value for $this->customerId + * @param Customer8 $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param CreateCashPaymentRequest $cash Initialization value for $this->cash + * @param PrivateLabel $privateLabel Initialization value for $this->privateLabel + * @param Pix $pix Initialization value for $this->pix */ public function __construct() { diff --git a/src/Models/CreatePhonesRequest.php b/src/Models/CreatePhonesRequest.php index f5133d4..82211d5 100644 --- a/src/Models/CreatePhonesRequest.php +++ b/src/Models/CreatePhonesRequest.php @@ -17,21 +17,21 @@ class CreatePhonesRequest implements JsonSerializable /** * @todo Write general description for this property * @maps home_phone - * @var \MundiAPILib\Models\CreatePhoneRequest|null $homePhone public property + * @var \MundiAPILib\Models\GetPhoneResponse|null $homePhone public property */ public $homePhone; /** * @todo Write general description for this property * @maps mobile_phone - * @var \MundiAPILib\Models\CreatePhoneRequest|null $mobilePhone public property + * @var \MundiAPILib\Models\GetPhoneResponse|null $mobilePhone public property */ public $mobilePhone; /** * Constructor to set initial or default values of member properties - * @param CreatePhoneRequest $homePhone Initialization value for $this->homePhone - * @param CreatePhoneRequest $mobilePhone Initialization value for $this->mobilePhone + * @param GetPhoneResponse $homePhone Initialization value for $this->homePhone + * @param GetPhoneResponse $mobilePhone Initialization value for $this->mobilePhone */ public function __construct() { diff --git a/src/Models/CreatePlanItemRequest.php b/src/Models/CreatePlanItemRequest.php index fe2809c..3f54674 100644 --- a/src/Models/CreatePlanItemRequest.php +++ b/src/Models/CreatePlanItemRequest.php @@ -22,10 +22,10 @@ class CreatePlanItemRequest implements JsonSerializable public $name; /** - * Item's pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\CreatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme4 $pricingScheme public property */ public $pricingScheme; @@ -57,12 +57,12 @@ class CreatePlanItemRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param CreatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme - * @param string $id Initialization value for $this->id - * @param string $description Initialization value for $this->description - * @param integer $cycles Initialization value for $this->cycles - * @param integer $quantity Initialization value for $this->quantity + * @param string $name Initialization value for $this->name + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param string $id Initialization value for $this->id + * @param string $description Initialization value for $this->description + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity */ public function __construct() { diff --git a/src/Models/CreatePlanRequest.php b/src/Models/CreatePlanRequest.php index ea734af..fb35637 100644 --- a/src/Models/CreatePlanRequest.php +++ b/src/Models/CreatePlanRequest.php @@ -105,10 +105,10 @@ class CreatePlanRequest implements JsonSerializable public $billingType; /** - * Plan's pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\CreatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme4 $pricingScheme public property */ public $pricingScheme; @@ -147,24 +147,24 @@ class CreatePlanRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $description Initialization value for $this->description - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param array $items Initialization value for $this->items - * @param bool $shippable Initialization value for $this->shippable - * @param array $paymentMethods Initialization value for $this->paymentMethods - * @param array $installments Initialization value for $this->installments - * @param string $currency Initialization value for $this->currency - * @param string $interval Initialization value for $this->interval - * @param integer $intervalCount Initialization value for $this->intervalCount - * @param array $billingDays Initialization value for $this->billingDays - * @param string $billingType Initialization value for $this->billingType - * @param CreatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme - * @param array $metadata Initialization value for $this->metadata - * @param integer $minimumPrice Initialization value for $this->minimumPrice - * @param integer $cycles Initialization value for $this->cycles - * @param integer $quantity Initialization value for $this->quantity - * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + * @param string $name Initialization value for $this->name + * @param string $description Initialization value for $this->description + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param array $items Initialization value for $this->items + * @param bool $shippable Initialization value for $this->shippable + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param array $installments Initialization value for $this->installments + * @param string $currency Initialization value for $this->currency + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param array $billingDays Initialization value for $this->billingDays + * @param string $billingType Initialization value for $this->billingType + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param array $metadata Initialization value for $this->metadata + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays */ public function __construct() { diff --git a/src/Models/CreatePrivateLabelPaymentRequest.php b/src/Models/CreatePrivateLabelPaymentRequest.php index 52451e9..41adca0 100644 --- a/src/Models/CreatePrivateLabelPaymentRequest.php +++ b/src/Models/CreatePrivateLabelPaymentRequest.php @@ -28,8 +28,8 @@ class CreatePrivateLabelPaymentRequest implements JsonSerializable public $statementDescriptor; /** - * Card data - * @var \MundiAPILib\Models\CreateCardRequest|null $card public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Card1|null $card public property */ public $card; @@ -82,16 +82,16 @@ class CreatePrivateLabelPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $installments Initialization value for $this->installments - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $cardId Initialization value for $this->cardId - * @param string $cardToken Initialization value for $this->cardToken - * @param bool $recurrence Initialization value for $this->recurrence - * @param bool $capture Initialization value for $this->capture - * @param bool $extendedLimitEnabled Initialization value for $this->extendedLimitEnabled - * @param string $extendedLimitCode Initialization value for $this->extendedLimitCode - * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param integer $installments Initialization value for $this->installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param bool $capture Initialization value for $this->capture + * @param bool $extendedLimitEnabled Initialization value for $this->extendedLimitEnabled + * @param string $extendedLimitCode Initialization value for $this->extendedLimitCode + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle */ public function __construct() { diff --git a/src/Models/CreateRecipientRequest.php b/src/Models/CreateRecipientRequest.php index 84a5aff..f65fef5 100644 --- a/src/Models/CreateRecipientRequest.php +++ b/src/Models/CreateRecipientRequest.php @@ -50,10 +50,10 @@ class CreateRecipientRequest implements JsonSerializable public $type; /** - * Bank account + * @todo Write general description for this property * @required * @maps default_bank_account - * @var \MundiAPILib\Models\CreateBankAccountRequest $defaultBankAccount public property + * @var \MundiAPILib\Models\DefaultBankAccount1 $defaultBankAccount public property */ public $defaultBankAccount; @@ -65,9 +65,9 @@ class CreateRecipientRequest implements JsonSerializable public $metadata; /** - * Receiver Transfer Information + * @todo Write general description for this property * @maps transfer_settings - * @var \MundiAPILib\Models\CreateTransferSettingsRequest|null $transferSettings public property + * @var \MundiAPILib\Models\GetTransferSettingsResponse|null $transferSettings public property */ public $transferSettings; @@ -88,36 +88,30 @@ class CreateRecipientRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $email Initialization value for $this->email - * @param string $description Initialization value for $this->description - * @param string $document Initialization value for $this->document - * @param string $type Initialization value for $this->type - * @param CreateBankAccountRequest $defaultBankAccount Initialization value for $this->defaultBankAccount - * @param array $metadata Initialization value for $this->metadata - * @param CreateTransferSettingsRequest $transferSettings Initialization value for $this->transferSettings - * @param string $code Initialization value for $this->code - * @param string $paymentMode Initialization value for $this->paymentMode + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param string $description Initialization value for $this->description + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param DefaultBankAccount1 $defaultBankAccount Initialization value for $this->defaultBankAccount + * @param array $metadata Initialization value for $this->metadata + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this->transferSettings + * @param string $code Initialization value for $this->code + * @param string $paymentMode Initialization value for $this->paymentMode */ public function __construct() { - switch (func_num_args()) { - case 10: - $this->name = func_get_arg(0); - $this->email = func_get_arg(1); - $this->description = func_get_arg(2); - $this->document = func_get_arg(3); - $this->type = func_get_arg(4); - $this->defaultBankAccount = func_get_arg(5); - $this->metadata = func_get_arg(6); - $this->transferSettings = func_get_arg(7); - $this->code = func_get_arg(8); - $this->paymentMode = func_get_arg(9); - break; - - default: - $this->paymentMode = 'bank_transfer'; - break; + if (10 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->description = func_get_arg(2); + $this->document = func_get_arg(3); + $this->type = func_get_arg(4); + $this->defaultBankAccount = func_get_arg(5); + $this->metadata = func_get_arg(6); + $this->transferSettings = func_get_arg(7); + $this->code = func_get_arg(8); + $this->paymentMode = func_get_arg(9); } } diff --git a/src/Models/CreateSetupRequest.php b/src/Models/CreateSetupRequest.php index 58f47cf..df2d828 100644 --- a/src/Models/CreateSetupRequest.php +++ b/src/Models/CreateSetupRequest.php @@ -30,17 +30,17 @@ class CreateSetupRequest implements JsonSerializable public $description; /** - * Payment data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreatePaymentRequest $payment public property + * @var \MundiAPILib\Models\Payment $payment public property */ public $payment; /** * Constructor to set initial or default values of member properties - * @param integer $amount Initialization value for $this->amount - * @param string $description Initialization value for $this->description - * @param CreatePaymentRequest $payment Initialization value for $this->payment + * @param integer $amount Initialization value for $this->amount + * @param string $description Initialization value for $this->description + * @param Payment $payment Initialization value for $this->payment */ public function __construct() { diff --git a/src/Models/CreateShippingRequest.php b/src/Models/CreateShippingRequest.php index 2edc067..385adc7 100644 --- a/src/Models/CreateShippingRequest.php +++ b/src/Models/CreateShippingRequest.php @@ -54,9 +54,9 @@ class CreateShippingRequest implements JsonSerializable public $addressId; /** - * Address data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateAddressRequest $address public property + * @var \MundiAPILib\Models\Address1 $address public property */ public $address; @@ -85,15 +85,15 @@ class CreateShippingRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $amount Initialization value for $this->amount - * @param string $description Initialization value for $this->description - * @param string $recipientName Initialization value for $this->recipientName - * @param string $recipientPhone Initialization value for $this->recipientPhone - * @param string $addressId Initialization value for $this->addressId - * @param CreateAddressRequest $address Initialization value for $this->address - * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate - * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate - * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + * @param string $description Initialization value for $this->description + * @param string $recipientName Initialization value for $this->recipientName + * @param string $recipientPhone Initialization value for $this->recipientPhone + * @param string $addressId Initialization value for $this->addressId + * @param Address1 $address Initialization value for $this->address + * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate + * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate + * @param string $type Initialization value for $this->type */ public function __construct() { diff --git a/src/Models/CreateSplitRequest.php b/src/Models/CreateSplitRequest.php index 6abe5b1..d689ce6 100644 --- a/src/Models/CreateSplitRequest.php +++ b/src/Models/CreateSplitRequest.php @@ -37,17 +37,17 @@ class CreateSplitRequest implements JsonSerializable public $recipientId; /** - * The split options request - * @var \MundiAPILib\Models\CreateSplitOptionsRequest|null $options public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Options2|null $options public property */ public $options; /** * Constructor to set initial or default values of member properties - * @param string $type Initialization value for $this->type - * @param integer $amount Initialization value for $this->amount - * @param string $recipientId Initialization value for $this->recipientId - * @param CreateSplitOptionsRequest $options Initialization value for $this->options + * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + * @param string $recipientId Initialization value for $this->recipientId + * @param Options2 $options Initialization value for $this->options */ public function __construct() { diff --git a/src/Models/CreateSubMerchantRequest.php b/src/Models/CreateSubMerchantRequest.php index d254cb4..f368d54 100644 --- a/src/Models/CreateSubMerchantRequest.php +++ b/src/Models/CreateSubMerchantRequest.php @@ -59,29 +59,29 @@ class CreateSubMerchantRequest implements JsonSerializable public $type; /** - * Phone + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreatePhoneRequest $phone public property + * @var \MundiAPILib\Models\GetPhoneResponse $phone public property */ public $phone; /** - * Address + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateAddressRequest $address public property + * @var \MundiAPILib\Models\Address1 $address public property */ public $address; /** * Constructor to set initial or default values of member properties - * @param string $paymentFacilitatorCode Initialization value for $this->paymentFacilitatorCode - * @param string $code Initialization value for $this->code - * @param string $name Initialization value for $this->name - * @param string $merchantCategoryCode Initialization value for $this->merchantCategoryCode - * @param string $document Initialization value for $this->document - * @param string $type Initialization value for $this->type - * @param CreatePhoneRequest $phone Initialization value for $this->phone - * @param CreateAddressRequest $address Initialization value for $this->address + * @param string $paymentFacilitatorCode Initialization value for $this->paymentFacilitatorCode + * @param string $code Initialization value for $this->code + * @param string $name Initialization value for $this->name + * @param string $merchantCategoryCode Initialization value for $this->merchantCategoryCode + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param GetPhoneResponse $phone Initialization value for $this->phone + * @param Address1 $address Initialization value for $this->address */ public function __construct() { diff --git a/src/Models/CreateSubscriptionItemRequest.php b/src/Models/CreateSubscriptionItemRequest.php index a988795..581a6db 100644 --- a/src/Models/CreateSubscriptionItemRequest.php +++ b/src/Models/CreateSubscriptionItemRequest.php @@ -22,10 +22,10 @@ class CreateSubscriptionItemRequest implements JsonSerializable public $description; /** - * Pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\CreatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme4 $pricingScheme public property */ public $pricingScheme; @@ -79,15 +79,15 @@ class CreateSubscriptionItemRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $description Initialization value for $this->description - * @param CreatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme - * @param string $id Initialization value for $this->id - * @param string $planItemId Initialization value for $this->planItemId - * @param array $discounts Initialization value for $this->discounts - * @param string $name Initialization value for $this->name - * @param integer $cycles Initialization value for $this->cycles - * @param integer $quantity Initialization value for $this->quantity - * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param string $description Initialization value for $this->description + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param string $id Initialization value for $this->id + * @param string $planItemId Initialization value for $this->planItemId + * @param array $discounts Initialization value for $this->discounts + * @param string $name Initialization value for $this->name + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $minimumPrice Initialization value for $this->minimumPrice */ public function __construct() { diff --git a/src/Models/CreateSubscriptionRequest.php b/src/Models/CreateSubscriptionRequest.php index 4a4d76d..40acdb0 100644 --- a/src/Models/CreateSubscriptionRequest.php +++ b/src/Models/CreateSubscriptionRequest.php @@ -16,16 +16,16 @@ class CreateSubscriptionRequest implements JsonSerializable { /** - * Customer + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCustomerRequest $customer public property + * @var \MundiAPILib\Models\Customer8 $customer public property */ public $customer; /** - * Card + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardRequest $card public property + * @var \MundiAPILib\Models\Card1 $card public property */ public $card; @@ -90,10 +90,10 @@ class CreateSubscriptionRequest implements JsonSerializable public $intervalCount; /** - * Subscription pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\CreatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme4 $pricingScheme public property */ public $pricingScheme; @@ -105,9 +105,9 @@ class CreateSubscriptionRequest implements JsonSerializable public $items; /** - * Shipping + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateShippingRequest $shipping public property + * @var \MundiAPILib\Models\Shipping3 $shipping public property */ public $shipping; @@ -126,9 +126,9 @@ class CreateSubscriptionRequest implements JsonSerializable public $metadata; /** - * Setup data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateSetupRequest $setup public property + * @var \MundiAPILib\Models\Setup1 $setup public property */ public $setup; @@ -228,21 +228,21 @@ class CreateSubscriptionRequest implements JsonSerializable public $period; /** - * SubMerchant - * @var \MundiAPILib\Models\CreateSubMerchantRequest|null $submerchant public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Submerchant|null $submerchant public property */ public $submerchant; /** - * Subscription's split - * @var \MundiAPILib\Models\CreateSubscriptionSplitRequest|null $split public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\UpdateSubscriptionSplitRequest|null $split public property */ public $split; /** * Constructor to set initial or default values of member properties - * @param CreateCustomerRequest $customer Initialization value for $this->customer - * @param CreateCardRequest $card Initialization value for $this->card + * @param Customer8 $customer Initialization value for $this->customer + * @param Card1 $card Initialization value for $this->card * @param string $code Initialization value for $this->code * @param string $paymentMethod Initialization value for $this->paymentMethod * @param string $billingType Initialization value for $this->billingType @@ -252,12 +252,12 @@ class CreateSubscriptionRequest implements JsonSerializable * @param string $currency Initialization value for $this->currency * @param string $interval Initialization value for $this->interval * @param integer $intervalCount Initialization value for $this->intervalCount - * @param CreatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme * @param array $items Initialization value for $this->items - * @param CreateShippingRequest $shipping Initialization value for $this->shipping + * @param Shipping3 $shipping Initialization value for $this->shipping * @param array $discounts Initialization value for $this->discounts * @param array $metadata Initialization value for $this->metadata - * @param CreateSetupRequest $setup Initialization value for $this->setup + * @param Setup1 $setup Initialization value for $this->setup * @param string $planId Initialization value for $this->planId * @param string $customerId Initialization value for $this->customerId * @param string $cardId Initialization value for $this->cardId @@ -273,8 +273,8 @@ class CreateSubscriptionRequest implements JsonSerializable * @param integer $boletoDueDays Initialization value for $this->boletoDueDays * @param array $increments Initialization value for $this->increments * @param CreatePeriodRequest $period Initialization value for $this->period - * @param CreateSubMerchantRequest $submerchant Initialization value for $this->submerchant - * @param CreateSubscriptionSplitRequest $split Initialization value for $this->split + * @param Submerchant $submerchant Initialization value for $this->submerchant + * @param UpdateSubscriptionSplitRequest $split Initialization value for $this->split */ public function __construct() { diff --git a/src/Models/CreateTokenRequest.php b/src/Models/CreateTokenRequest.php index 153a662..fe2b468 100644 --- a/src/Models/CreateTokenRequest.php +++ b/src/Models/CreateTokenRequest.php @@ -22,28 +22,22 @@ class CreateTokenRequest implements JsonSerializable public $type; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardTokenRequest $card public property + * @var \MundiAPILib\Models\Card11 $card public property */ public $card; /** * Constructor to set initial or default values of member properties - * @param string $type Initialization value for $this->type - * @param CreateCardTokenRequest $card Initialization value for $this->card + * @param string $type Initialization value for $this->type + * @param Card11 $card Initialization value for $this->card */ public function __construct() { - switch (func_num_args()) { - case 2: - $this->type = func_get_arg(0); - $this->card = func_get_arg(1); - break; - - default: - $this->type = 'card'; - break; + if (2 == func_num_args()) { + $this->type = func_get_arg(0); + $this->card = func_get_arg(1); } } diff --git a/src/Models/CreateVoucherPaymentRequest.php b/src/Models/CreateVoucherPaymentRequest.php index bbe571b..d7896ff 100644 --- a/src/Models/CreateVoucherPaymentRequest.php +++ b/src/Models/CreateVoucherPaymentRequest.php @@ -36,9 +36,9 @@ class CreateVoucherPaymentRequest implements JsonSerializable public $cardToken; /** - * Card info + * @todo Write general description for this property * @maps Card - * @var \MundiAPILib\Models\CreateCardRequest|null $card public property + * @var \MundiAPILib\Models\Card1|null $card public property */ public $card; @@ -51,11 +51,11 @@ class CreateVoucherPaymentRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param string $cardId Initialization value for $this->cardId - * @param string $cardToken Initialization value for $this->cardToken - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param Card1 $card Initialization value for $this->card + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle */ public function __construct() { diff --git a/src/Models/CreditCard1.php b/src/Models/CreditCard1.php new file mode 100644 index 0000000..beb0ea2 --- /dev/null +++ b/src/Models/CreditCard1.php @@ -0,0 +1,187 @@ +installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param bool $capture Initialization value for $this->capture + * @param bool $extendedLimitEnabled Initialization value for $this->extendedLimitEnabled + * @param string $extendedLimitCode Initialization value for $this->extendedLimitCode + * @param integer $merchantCategoryCode Initialization value for $this->merchantCategoryCode + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param Contactless $contactless Initialization value for $this->contactless + * @param bool $autoRecovery Initialization value for $this->autoRecovery + * @param string $operationType Initialization value for $this->operationType + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + */ + public function __construct() + { + switch (func_num_args()) { + case 15: + $this->installments = func_get_arg(0); + $this->statementDescriptor = func_get_arg(1); + $this->card = func_get_arg(2); + $this->cardId = func_get_arg(3); + $this->cardToken = func_get_arg(4); + $this->recurrence = func_get_arg(5); + $this->capture = func_get_arg(6); + $this->extendedLimitEnabled = func_get_arg(7); + $this->extendedLimitCode = func_get_arg(8); + $this->merchantCategoryCode = func_get_arg(9); + $this->authentication = func_get_arg(10); + $this->contactless = func_get_arg(11); + $this->autoRecovery = func_get_arg(12); + $this->operationType = func_get_arg(13); + $this->recurrencyCycle = func_get_arg(14); + break; + + default: + $this->installments = 1; + $this->capture = true; + break; + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['installments'] = $this->installments; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['card'] = $this->card; + $json['card_id'] = $this->cardId; + $json['card_token'] = $this->cardToken; + $json['recurrence'] = $this->recurrence; + $json['capture'] = $this->capture; + $json['extended_limit_enabled'] = $this->extendedLimitEnabled; + $json['extended_limit_code'] = $this->extendedLimitCode; + $json['merchant_category_code'] = $this->merchantCategoryCode; + $json['authentication'] = $this->authentication; + $json['contactless'] = $this->contactless; + $json['auto_recovery'] = $this->autoRecovery; + $json['operation_type'] = $this->operationType; + $json['recurrency_cycle'] = $this->recurrencyCycle; + + return $json; + } +} diff --git a/src/Models/CreditCard2.php b/src/Models/CreditCard2.php new file mode 100644 index 0000000..e69f443 --- /dev/null +++ b/src/Models/CreditCard2.php @@ -0,0 +1,73 @@ +statementDescriptor + * @param array $installments Initialization value for $this->installments + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param bool $capture Initialization value for $this->capture + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->statementDescriptor = func_get_arg(0); + $this->installments = func_get_arg(1); + $this->authentication = func_get_arg(2); + $this->capture = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['statement_descriptor'] = $this->statementDescriptor; + $json['installments'] = $this->installments; + $json['authentication'] = $this->authentication; + $json['capture'] = $this->capture; + + return $json; + } +} diff --git a/src/Models/CurrentCycle.php b/src/Models/CurrentCycle.php new file mode 100644 index 0000000..2bfc9eb --- /dev/null +++ b/src/Models/CurrentCycle.php @@ -0,0 +1,145 @@ +startAt + * @param \DateTime $endAt Initialization value for $this->endAt + * @param string $id Initialization value for $this->id + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param string $status Initialization value for $this->status + * @param integer $duration Initialization value for $this->duration + * @param string $createdAt Initialization value for $this->createdAt + * @param string $updatedAt Initialization value for $this->updatedAt + * @param integer $cycle Initialization value for $this->cycle + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->startAt = func_get_arg(0); + $this->endAt = func_get_arg(1); + $this->id = func_get_arg(2); + $this->billingAt = func_get_arg(3); + $this->subscription = func_get_arg(4); + $this->status = func_get_arg(5); + $this->duration = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->cycle = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_at'] = DateTimeHelper::toRfc3339DateTime($this->startAt); + $json['end_at'] = DateTimeHelper::toRfc3339DateTime($this->endAt); + $json['id'] = $this->id; + $json['billing_at'] = DateTimeHelper::toRfc3339DateTime($this->billingAt); + $json['subscription'] = $this->subscription; + $json['status'] = $this->status; + $json['duration'] = $this->duration; + $json['created_at'] = $this->createdAt; + $json['updated_at'] = $this->updatedAt; + $json['cycle'] = $this->cycle; + + return $json; + } +} diff --git a/src/Models/Customer.php b/src/Models/Customer.php new file mode 100644 index 0000000..617744e --- /dev/null +++ b/src/Models/Customer.php @@ -0,0 +1,193 @@ +id + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param bool $delinquent Initialization value for $this->delinquent + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param string $fbAccessToken Initialization value for $this->fbAccessToken + * @param Address $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param GetPhonesResponse $phones Initialization value for $this->phones + * @param integer $fbId Initialization value for $this->fbId + * @param string $code Initialization value for $this->code + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (15 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->delinquent = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->updatedAt = func_get_arg(5); + $this->document = func_get_arg(6); + $this->type = func_get_arg(7); + $this->fbAccessToken = func_get_arg(8); + $this->address = func_get_arg(9); + $this->metadata = func_get_arg(10); + $this->phones = func_get_arg(11); + $this->fbId = func_get_arg(12); + $this->code = func_get_arg(13); + $this->documentType = func_get_arg(14); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['delinquent'] = $this->delinquent; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['fb_access_token'] = $this->fbAccessToken; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['fb_id'] = $this->fbId; + $json['code'] = $this->code; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/Customer8.php b/src/Models/Customer8.php new file mode 100644 index 0000000..9e84e88 --- /dev/null +++ b/src/Models/Customer8.php @@ -0,0 +1,135 @@ +name + * @param string $email Initialization value for $this->email + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param Address1 $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param CreatePhonesRequest $phones Initialization value for $this->phones + * @param string $code Initialization value for $this->code + * @param string $gender Initialization value for $this->gender + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->document = func_get_arg(2); + $this->type = func_get_arg(3); + $this->address = func_get_arg(4); + $this->metadata = func_get_arg(5); + $this->phones = func_get_arg(6); + $this->code = func_get_arg(7); + $this->gender = func_get_arg(8); + $this->documentType = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['code'] = $this->code; + $json['gender'] = $this->gender; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/CustomersAccessTokensRequest.php b/src/Models/CustomersAccessTokensRequest.php new file mode 100644 index 0000000..282a45d --- /dev/null +++ b/src/Models/CustomersAccessTokensRequest.php @@ -0,0 +1,46 @@ +expiresIn + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->expiresIn = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['expires_in'] = $this->expiresIn; + + return $json; + } +} diff --git a/src/Models/CustomersAccessTokensResponse.php b/src/Models/CustomersAccessTokensResponse.php new file mode 100644 index 0000000..1576bbd --- /dev/null +++ b/src/Models/CustomersAccessTokensResponse.php @@ -0,0 +1,88 @@ +id + * @param string $code Initialization value for $this->code + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param Customer $customer Initialization value for $this->customer + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->status = func_get_arg(2); + $this->createdAt = func_get_arg(3); + $this->customer = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['customer'] = $this->customer; + + return $json; + } +} diff --git a/src/Models/CustomersAccessTokensResponse1.php b/src/Models/CustomersAccessTokensResponse1.php new file mode 100644 index 0000000..5b99711 --- /dev/null +++ b/src/Models/CustomersAccessTokensResponse1.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/CustomersAddressesRequest.php b/src/Models/CustomersAddressesRequest.php new file mode 100644 index 0000000..0cad97f --- /dev/null +++ b/src/Models/CustomersAddressesRequest.php @@ -0,0 +1,150 @@ +street + * @param string $number Initialization value for $this->number + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $complement Initialization value for $this->complement + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->street = func_get_arg(0); + $this->number = func_get_arg(1); + $this->zipCode = func_get_arg(2); + $this->neighborhood = func_get_arg(3); + $this->city = func_get_arg(4); + $this->state = func_get_arg(5); + $this->country = func_get_arg(6); + $this->complement = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->line1 = func_get_arg(9); + $this->line2 = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['complement'] = $this->complement; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + + return $json; + } +} diff --git a/src/Models/CustomersAddressesRequest1.php b/src/Models/CustomersAddressesRequest1.php new file mode 100644 index 0000000..8a20f6a --- /dev/null +++ b/src/Models/CustomersAddressesRequest1.php @@ -0,0 +1,77 @@ +number + * @param string $complement Initialization value for $this->complement + * @param array $metadata Initialization value for $this->metadata + * @param string $line2 Initialization value for $this->line2 + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->number = func_get_arg(0); + $this->complement = func_get_arg(1); + $this->metadata = func_get_arg(2); + $this->line2 = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['number'] = $this->number; + $json['complement'] = $this->complement; + $json['metadata'] = $this->metadata; + $json['line_2'] = $this->line2; + + return $json; + } +} diff --git a/src/Models/CustomersAddressesResponse.php b/src/Models/CustomersAddressesResponse.php new file mode 100644 index 0000000..8281c3d --- /dev/null +++ b/src/Models/CustomersAddressesResponse.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/CustomersAddressesResponse1.php b/src/Models/CustomersAddressesResponse1.php new file mode 100644 index 0000000..d6721af --- /dev/null +++ b/src/Models/CustomersAddressesResponse1.php @@ -0,0 +1,215 @@ +id + * @param string $street Initialization value for $this->street + * @param string $number Initialization value for $this->number + * @param string $complement Initialization value for $this->complement + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->street = func_get_arg(1); + $this->number = func_get_arg(2); + $this->complement = func_get_arg(3); + $this->zipCode = func_get_arg(4); + $this->neighborhood = func_get_arg(5); + $this->city = func_get_arg(6); + $this->state = func_get_arg(7); + $this->country = func_get_arg(8); + $this->status = func_get_arg(9); + $this->createdAt = func_get_arg(10); + $this->updatedAt = func_get_arg(11); + $this->customer = func_get_arg(12); + $this->metadata = func_get_arg(13); + $this->line1 = func_get_arg(14); + $this->line2 = func_get_arg(15); + $this->deletedAt = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['street'] = $this->street; + $json['number'] = $this->number; + $json['complement'] = $this->complement; + $json['zip_code'] = $this->zipCode; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['country'] = $this->country; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['line_1'] = $this->line1; + $json['line_2'] = $this->line2; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/CustomersCardsRenewResponse.php b/src/Models/CustomersCardsRenewResponse.php new file mode 100644 index 0000000..e8e2125 --- /dev/null +++ b/src/Models/CustomersCardsRenewResponse.php @@ -0,0 +1,219 @@ +id + * @param string $lastFourDigits Initialization value for $this->lastFourDigits + * @param string $brand Initialization value for $this->brand + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param string $holderDocument Initialization value for $this->holderDocument + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $firstSixDigits Initialization value for $this->firstSixDigits + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->lastFourDigits = func_get_arg(1); + $this->brand = func_get_arg(2); + $this->holderName = func_get_arg(3); + $this->expMonth = func_get_arg(4); + $this->expYear = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->billingAddress = func_get_arg(9); + $this->customer = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->type = func_get_arg(12); + $this->holderDocument = func_get_arg(13); + $this->deletedAt = func_get_arg(14); + $this->firstSixDigits = func_get_arg(15); + $this->label = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['last_four_digits'] = $this->lastFourDigits; + $json['brand'] = $this->brand; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['billing_address'] = $this->billingAddress; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['type'] = $this->type; + $json['holder_document'] = $this->holderDocument; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['first_six_digits'] = $this->firstSixDigits; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/CustomersCardsRequest.php b/src/Models/CustomersCardsRequest.php new file mode 100644 index 0000000..63fd0f7 --- /dev/null +++ b/src/Models/CustomersCardsRequest.php @@ -0,0 +1,200 @@ +number + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $cvv Initialization value for $this->cvv + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param string $brand Initialization value for $this->brand + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param Options1 $options Initialization value for $this->options + * @param string $holderDocument Initialization value for $this->holderDocument + * @param bool $privateLabel Initialization value for $this->privateLabel + * @param string $label Initialization value for $this->label + * @param string $id Initialization value for $this->id + * @param string $token Initialization value for $this->token + */ + public function __construct() + { + if (16 == func_num_args()) { + $this->number = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->expMonth = func_get_arg(2); + $this->expYear = func_get_arg(3); + $this->cvv = func_get_arg(4); + $this->billingAddress = func_get_arg(5); + $this->brand = func_get_arg(6); + $this->billingAddressId = func_get_arg(7); + $this->metadata = func_get_arg(8); + $this->type = func_get_arg(9); + $this->options = func_get_arg(10); + $this->holderDocument = func_get_arg(11); + $this->privateLabel = func_get_arg(12); + $this->label = func_get_arg(13); + $this->id = func_get_arg(14); + $this->token = func_get_arg(15); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['number'] = $this->number; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['cvv'] = $this->cvv; + $json['billing_address'] = $this->billingAddress; + $json['brand'] = $this->brand; + $json['billing_address_id'] = $this->billingAddressId; + $json['metadata'] = $this->metadata; + $json['type'] = $this->type; + $json['options'] = $this->options; + $json['holder_document'] = $this->holderDocument; + $json['private_label'] = $this->privateLabel; + $json['label'] = $this->label; + $json['id'] = $this->id; + $json['token'] = $this->token; + + return $json; + } +} diff --git a/src/Models/CustomersCardsRequest1.php b/src/Models/CustomersCardsRequest1.php new file mode 100644 index 0000000..4f8f566 --- /dev/null +++ b/src/Models/CustomersCardsRequest1.php @@ -0,0 +1,111 @@ +holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param array $metadata Initialization value for $this->metadata + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (7 == func_num_args()) { + $this->holderName = func_get_arg(0); + $this->expMonth = func_get_arg(1); + $this->expYear = func_get_arg(2); + $this->billingAddressId = func_get_arg(3); + $this->billingAddress = func_get_arg(4); + $this->metadata = func_get_arg(5); + $this->label = func_get_arg(6); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['billing_address_id'] = $this->billingAddressId; + $json['billing_address'] = $this->billingAddress; + $json['metadata'] = $this->metadata; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/CustomersCardsResponse.php b/src/Models/CustomersCardsResponse.php new file mode 100644 index 0000000..5851068 --- /dev/null +++ b/src/Models/CustomersCardsResponse.php @@ -0,0 +1,219 @@ +id + * @param string $lastFourDigits Initialization value for $this->lastFourDigits + * @param string $brand Initialization value for $this->brand + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param string $holderDocument Initialization value for $this->holderDocument + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $firstSixDigits Initialization value for $this->firstSixDigits + * @param string $label Initialization value for $this->label + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->lastFourDigits = func_get_arg(1); + $this->brand = func_get_arg(2); + $this->holderName = func_get_arg(3); + $this->expMonth = func_get_arg(4); + $this->expYear = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->billingAddress = func_get_arg(9); + $this->customer = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->type = func_get_arg(12); + $this->holderDocument = func_get_arg(13); + $this->deletedAt = func_get_arg(14); + $this->firstSixDigits = func_get_arg(15); + $this->label = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['last_four_digits'] = $this->lastFourDigits; + $json['brand'] = $this->brand; + $json['holder_name'] = $this->holderName; + $json['exp_month'] = $this->expMonth; + $json['exp_year'] = $this->expYear; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['billing_address'] = $this->billingAddress; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['type'] = $this->type; + $json['holder_document'] = $this->holderDocument; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['first_six_digits'] = $this->firstSixDigits; + $json['label'] = $this->label; + + return $json; + } +} diff --git a/src/Models/CustomersCardsResponse1.php b/src/Models/CustomersCardsResponse1.php new file mode 100644 index 0000000..671c8cb --- /dev/null +++ b/src/Models/CustomersCardsResponse1.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/CustomersMetadataRequest.php b/src/Models/CustomersMetadataRequest.php new file mode 100644 index 0000000..946c544 --- /dev/null +++ b/src/Models/CustomersMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/CustomersMetadataResponse.php b/src/Models/CustomersMetadataResponse.php new file mode 100644 index 0000000..12103ca --- /dev/null +++ b/src/Models/CustomersMetadataResponse.php @@ -0,0 +1,193 @@ +id + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param bool $delinquent Initialization value for $this->delinquent + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param string $fbAccessToken Initialization value for $this->fbAccessToken + * @param Address $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param GetPhonesResponse $phones Initialization value for $this->phones + * @param integer $fbId Initialization value for $this->fbId + * @param string $code Initialization value for $this->code + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (15 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->delinquent = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->updatedAt = func_get_arg(5); + $this->document = func_get_arg(6); + $this->type = func_get_arg(7); + $this->fbAccessToken = func_get_arg(8); + $this->address = func_get_arg(9); + $this->metadata = func_get_arg(10); + $this->phones = func_get_arg(11); + $this->fbId = func_get_arg(12); + $this->code = func_get_arg(13); + $this->documentType = func_get_arg(14); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['delinquent'] = $this->delinquent; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['fb_access_token'] = $this->fbAccessToken; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['fb_id'] = $this->fbId; + $json['code'] = $this->code; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/CustomersRequest.php b/src/Models/CustomersRequest.php new file mode 100644 index 0000000..f0258f2 --- /dev/null +++ b/src/Models/CustomersRequest.php @@ -0,0 +1,127 @@ +name + * @param string $email Initialization value for $this->email + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param Address1 $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param CreatePhonesRequest $phones Initialization value for $this->phones + * @param string $code Initialization value for $this->code + * @param string $gender Initialization value for $this->gender + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->document = func_get_arg(2); + $this->type = func_get_arg(3); + $this->address = func_get_arg(4); + $this->metadata = func_get_arg(5); + $this->phones = func_get_arg(6); + $this->code = func_get_arg(7); + $this->gender = func_get_arg(8); + $this->documentType = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['code'] = $this->code; + $json['gender'] = $this->gender; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/CustomersRequest1.php b/src/Models/CustomersRequest1.php new file mode 100644 index 0000000..3681201 --- /dev/null +++ b/src/Models/CustomersRequest1.php @@ -0,0 +1,135 @@ +name + * @param string $email Initialization value for $this->email + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param Address1 $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param CreatePhonesRequest $phones Initialization value for $this->phones + * @param string $code Initialization value for $this->code + * @param string $gender Initialization value for $this->gender + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->document = func_get_arg(2); + $this->type = func_get_arg(3); + $this->address = func_get_arg(4); + $this->metadata = func_get_arg(5); + $this->phones = func_get_arg(6); + $this->code = func_get_arg(7); + $this->gender = func_get_arg(8); + $this->documentType = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['code'] = $this->code; + $json['gender'] = $this->gender; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/CustomersResponse.php b/src/Models/CustomersResponse.php new file mode 100644 index 0000000..bb38d0b --- /dev/null +++ b/src/Models/CustomersResponse.php @@ -0,0 +1,193 @@ +id + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param bool $delinquent Initialization value for $this->delinquent + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param string $fbAccessToken Initialization value for $this->fbAccessToken + * @param Address $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param GetPhonesResponse $phones Initialization value for $this->phones + * @param integer $fbId Initialization value for $this->fbId + * @param string $code Initialization value for $this->code + * @param string $documentType Initialization value for $this->documentType + */ + public function __construct() + { + if (15 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->delinquent = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->updatedAt = func_get_arg(5); + $this->document = func_get_arg(6); + $this->type = func_get_arg(7); + $this->fbAccessToken = func_get_arg(8); + $this->address = func_get_arg(9); + $this->metadata = func_get_arg(10); + $this->phones = func_get_arg(11); + $this->fbId = func_get_arg(12); + $this->code = func_get_arg(13); + $this->documentType = func_get_arg(14); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['delinquent'] = $this->delinquent; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['fb_access_token'] = $this->fbAccessToken; + $json['address'] = $this->address; + $json['metadata'] = $this->metadata; + $json['phones'] = $this->phones; + $json['fb_id'] = $this->fbId; + $json['code'] = $this->code; + $json['document_type'] = $this->documentType; + + return $json; + } +} diff --git a/src/Models/CustomersResponse3.php b/src/Models/CustomersResponse3.php new file mode 100644 index 0000000..1a2afd6 --- /dev/null +++ b/src/Models/CustomersResponse3.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/Cycle.php b/src/Models/Cycle.php new file mode 100644 index 0000000..dacdb18 --- /dev/null +++ b/src/Models/Cycle.php @@ -0,0 +1,145 @@ +startAt + * @param \DateTime $endAt Initialization value for $this->endAt + * @param string $id Initialization value for $this->id + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param string $status Initialization value for $this->status + * @param integer $duration Initialization value for $this->duration + * @param string $createdAt Initialization value for $this->createdAt + * @param string $updatedAt Initialization value for $this->updatedAt + * @param integer $cycle Initialization value for $this->cycle + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->startAt = func_get_arg(0); + $this->endAt = func_get_arg(1); + $this->id = func_get_arg(2); + $this->billingAt = func_get_arg(3); + $this->subscription = func_get_arg(4); + $this->status = func_get_arg(5); + $this->duration = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->cycle = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_at'] = DateTimeHelper::toRfc3339DateTime($this->startAt); + $json['end_at'] = DateTimeHelper::toRfc3339DateTime($this->endAt); + $json['id'] = $this->id; + $json['billing_at'] = DateTimeHelper::toRfc3339DateTime($this->billingAt); + $json['subscription'] = $this->subscription; + $json['status'] = $this->status; + $json['duration'] = $this->duration; + $json['created_at'] = $this->createdAt; + $json['updated_at'] = $this->updatedAt; + $json['cycle'] = $this->cycle; + + return $json; + } +} diff --git a/src/Models/DebitCard1.php b/src/Models/DebitCard1.php new file mode 100644 index 0000000..1228847 --- /dev/null +++ b/src/Models/DebitCard1.php @@ -0,0 +1,112 @@ +statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param Authentication2 $authentication Initialization value for $this->authentication + * @param Token $token Initialization value for $this->token + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + */ + public function __construct() + { + if (8 == func_num_args()) { + $this->statementDescriptor = func_get_arg(0); + $this->card = func_get_arg(1); + $this->cardId = func_get_arg(2); + $this->cardToken = func_get_arg(3); + $this->recurrence = func_get_arg(4); + $this->authentication = func_get_arg(5); + $this->token = func_get_arg(6); + $this->recurrencyCycle = func_get_arg(7); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['statement_descriptor'] = $this->statementDescriptor; + $json['card'] = $this->card; + $json['card_id'] = $this->cardId; + $json['card_token'] = $this->cardToken; + $json['recurrence'] = $this->recurrence; + $json['authentication'] = $this->authentication; + $json['token'] = $this->token; + $json['recurrency_cycle'] = $this->recurrencyCycle; + + return $json; + } +} diff --git a/src/Models/DebitCard2.php b/src/Models/DebitCard2.php new file mode 100644 index 0000000..1875314 --- /dev/null +++ b/src/Models/DebitCard2.php @@ -0,0 +1,56 @@ +statementDescriptor + * @param Authentication2 $authentication Initialization value for $this->authentication + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->statementDescriptor = func_get_arg(0); + $this->authentication = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['statement_descriptor'] = $this->statementDescriptor; + $json['authentication'] = $this->authentication; + + return $json; + } +} diff --git a/src/Models/DefaultBankAccount.php b/src/Models/DefaultBankAccount.php new file mode 100644 index 0000000..0dd46b8 --- /dev/null +++ b/src/Models/DefaultBankAccount.php @@ -0,0 +1,209 @@ +id + * @param string $holderName Initialization value for $this->holderName + * @param string $holderType Initialization value for $this->holderType + * @param string $bank Initialization value for $this->bank + * @param string $branchNumber Initialization value for $this->branchNumber + * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit + * @param string $accountNumber Initialization value for $this->accountNumber + * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit + * @param string $type Initialization value for $this->type + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param Recipient $recipient Initialization value for $this->recipient + * @param array $metadata Initialization value for $this->metadata + * @param string $pixKey Initialization value for $this->pixKey + */ + public function __construct() + { + if (16 == func_num_args()) { + $this->id = func_get_arg(0); + $this->holderName = func_get_arg(1); + $this->holderType = func_get_arg(2); + $this->bank = func_get_arg(3); + $this->branchNumber = func_get_arg(4); + $this->branchCheckDigit = func_get_arg(5); + $this->accountNumber = func_get_arg(6); + $this->accountCheckDigit = func_get_arg(7); + $this->type = func_get_arg(8); + $this->status = func_get_arg(9); + $this->createdAt = func_get_arg(10); + $this->updatedAt = func_get_arg(11); + $this->deletedAt = func_get_arg(12); + $this->recipient = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->pixKey = func_get_arg(15); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['holder_name'] = $this->holderName; + $json['holder_type'] = $this->holderType; + $json['bank'] = $this->bank; + $json['branch_number'] = $this->branchNumber; + $json['branch_check_digit'] = $this->branchCheckDigit; + $json['account_number'] = $this->accountNumber; + $json['account_check_digit'] = $this->accountCheckDigit; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['recipient'] = $this->recipient; + $json['metadata'] = $this->metadata; + $json['pix_key'] = $this->pixKey; + + return $json; + } +} diff --git a/src/Models/DefaultBankAccount1.php b/src/Models/DefaultBankAccount1.php new file mode 100644 index 0000000..5129356 --- /dev/null +++ b/src/Models/DefaultBankAccount1.php @@ -0,0 +1,154 @@ +holderName + * @param string $holderType Initialization value for $this->holderType + * @param string $holderDocument Initialization value for $this->holderDocument + * @param string $bank Initialization value for $this->bank + * @param string $branchNumber Initialization value for $this->branchNumber + * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit + * @param string $accountNumber Initialization value for $this->accountNumber + * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit + * @param string $type Initialization value for $this->type + * @param array $metadata Initialization value for $this->metadata + * @param string $pixKey Initialization value for $this->pixKey + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->holderName = func_get_arg(0); + $this->holderType = func_get_arg(1); + $this->holderDocument = func_get_arg(2); + $this->bank = func_get_arg(3); + $this->branchNumber = func_get_arg(4); + $this->branchCheckDigit = func_get_arg(5); + $this->accountNumber = func_get_arg(6); + $this->accountCheckDigit = func_get_arg(7); + $this->type = func_get_arg(8); + $this->metadata = func_get_arg(9); + $this->pixKey = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['holder_name'] = $this->holderName; + $json['holder_type'] = $this->holderType; + $json['holder_document'] = $this->holderDocument; + $json['bank'] = $this->bank; + $json['branch_number'] = $this->branchNumber; + $json['branch_check_digit'] = $this->branchCheckDigit; + $json['account_number'] = $this->accountNumber; + $json['account_check_digit'] = $this->accountCheckDigit; + $json['type'] = $this->type; + $json['metadata'] = $this->metadata; + $json['pix_key'] = $this->pixKey; + + return $json; + } +} diff --git a/src/Models/Device.php b/src/Models/Device.php new file mode 100644 index 0000000..0c794f6 --- /dev/null +++ b/src/Models/Device.php @@ -0,0 +1,45 @@ +platform + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->platform = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['platform'] = $this->platform; + + return $json; + } +} diff --git a/src/Models/Device1.php b/src/Models/Device1.php new file mode 100644 index 0000000..d72081b --- /dev/null +++ b/src/Models/Device1.php @@ -0,0 +1,45 @@ +platform + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->platform = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['platform'] = $this->platform; + + return $json; + } +} diff --git a/src/Models/Fine.php b/src/Models/Fine.php new file mode 100644 index 0000000..3076e3e --- /dev/null +++ b/src/Models/Fine.php @@ -0,0 +1,66 @@ +days + * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->days = func_get_arg(0); + $this->type = func_get_arg(1); + $this->amount = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['days'] = $this->days; + $json['type'] = $this->type; + $json['amount'] = $this->amount; + + return $json; + } +} diff --git a/src/Models/GatewayResponse.php b/src/Models/GatewayResponse.php new file mode 100644 index 0000000..c7a8751 --- /dev/null +++ b/src/Models/GatewayResponse.php @@ -0,0 +1,56 @@ +code + * @param array $errors Initialization value for $this->errors + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->code = func_get_arg(0); + $this->errors = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['code'] = $this->code; + $json['errors'] = $this->errors; + + return $json; + } +} diff --git a/src/Models/GetAccessTokenResponse.php b/src/Models/GetAccessTokenResponse.php index f3456ad..ca5a634 100644 --- a/src/Models/GetAccessTokenResponse.php +++ b/src/Models/GetAccessTokenResponse.php @@ -47,17 +47,17 @@ class GetAccessTokenResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $code Initialization value for $this->code - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param GetCustomerResponse $customer Initialization value for $this->customer + * @param string $id Initialization value for $this->id + * @param string $code Initialization value for $this->code + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param Customer $customer Initialization value for $this->customer */ public function __construct() { diff --git a/src/Models/GetAddressResponse.php b/src/Models/GetAddressResponse.php index d94f720..02a11db 100644 --- a/src/Models/GetAddressResponse.php +++ b/src/Models/GetAddressResponse.php @@ -106,7 +106,7 @@ class GetAddressResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; @@ -143,23 +143,23 @@ class GetAddressResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $street Initialization value for $this->street - * @param string $number Initialization value for $this->number - * @param string $complement Initialization value for $this->complement - * @param string $zipCode Initialization value for $this->zipCode - * @param string $neighborhood Initialization value for $this->neighborhood - * @param string $city Initialization value for $this->city - * @param string $state Initialization value for $this->state - * @param string $country Initialization value for $this->country - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param array $metadata Initialization value for $this->metadata - * @param string $line1 Initialization value for $this->line1 - * @param string $line2 Initialization value for $this->line2 - * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $id Initialization value for $this->id + * @param string $street Initialization value for $this->street + * @param string $number Initialization value for $this->number + * @param string $complement Initialization value for $this->complement + * @param string $zipCode Initialization value for $this->zipCode + * @param string $neighborhood Initialization value for $this->neighborhood + * @param string $city Initialization value for $this->city + * @param string $state Initialization value for $this->state + * @param string $country Initialization value for $this->country + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $line1 Initialization value for $this->line1 + * @param string $line2 Initialization value for $this->line2 + * @param \DateTime $deletedAt Initialization value for $this->deletedAt */ public function __construct() { diff --git a/src/Models/GetAnticipationLimitsResponse.php b/src/Models/GetAnticipationLimitsResponse.php index cee5a9d..78dc010 100644 --- a/src/Models/GetAnticipationLimitsResponse.php +++ b/src/Models/GetAnticipationLimitsResponse.php @@ -15,23 +15,23 @@ class GetAnticipationLimitsResponse implements JsonSerializable { /** - * Max limit + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetAnticipationLimitResponse $max public property + * @var \MundiAPILib\Models\Max $max public property */ public $max; /** - * Min limit + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetAnticipationLimitResponse $min public property + * @var \MundiAPILib\Models\Min $min public property */ public $min; /** * Constructor to set initial or default values of member properties - * @param GetAnticipationLimitResponse $max Initialization value for $this->max - * @param GetAnticipationLimitResponse $min Initialization value for $this->min + * @param Max $max Initialization value for $this->max + * @param Min $min Initialization value for $this->min */ public function __construct() { diff --git a/src/Models/GetAnticipationResponse.php b/src/Models/GetAnticipationResponse.php index cd367c4..2c4c6f2 100644 --- a/src/Models/GetAnticipationResponse.php +++ b/src/Models/GetAnticipationResponse.php @@ -39,8 +39,8 @@ class GetAnticipationResponse implements JsonSerializable public $approvedAmount; /** - * Recipient - * @var \MundiAPILib\Models\GetRecipientResponse|null $recipient public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Recipient|null $recipient public property */ public $recipient; @@ -94,16 +94,16 @@ class GetAnticipationResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param integer $requestedAmount Initialization value for $this->requestedAmount - * @param integer $approvedAmount Initialization value for $this->approvedAmount - * @param GetRecipientResponse $recipient Initialization value for $this->recipient - * @param string $pgid Initialization value for $this->pgid - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param \DateTime $paymentDate Initialization value for $this->paymentDate - * @param string $status Initialization value for $this->status - * @param string $timeframe Initialization value for $this->timeframe + * @param string $id Initialization value for $this->id + * @param integer $requestedAmount Initialization value for $this->requestedAmount + * @param integer $approvedAmount Initialization value for $this->approvedAmount + * @param Recipient $recipient Initialization value for $this->recipient + * @param string $pgid Initialization value for $this->pgid + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param \DateTime $paymentDate Initialization value for $this->paymentDate + * @param string $status Initialization value for $this->status + * @param string $timeframe Initialization value for $this->timeframe */ public function __construct() { diff --git a/src/Models/GetBalanceResponse.php b/src/Models/GetBalanceResponse.php index 9659be9..4f20d34 100644 --- a/src/Models/GetBalanceResponse.php +++ b/src/Models/GetBalanceResponse.php @@ -30,8 +30,8 @@ class GetBalanceResponse implements JsonSerializable public $availableAmount; /** - * Recipient - * @var \MundiAPILib\Models\GetRecipientResponse|null $recipient public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Recipient|null $recipient public property */ public $recipient; @@ -53,11 +53,11 @@ class GetBalanceResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $currency Initialization value for $this->currency - * @param integer $availableAmount Initialization value for $this->availableAmount - * @param GetRecipientResponse $recipient Initialization value for $this->recipient - * @param integer $waitingFundsAmount Initialization value for $this->waitingFundsAmount - * @param integer $transferredAmount Initialization value for $this->transferredAmount + * @param string $currency Initialization value for $this->currency + * @param integer $availableAmount Initialization value for $this->availableAmount + * @param Recipient $recipient Initialization value for $this->recipient + * @param integer $waitingFundsAmount Initialization value for $this->waitingFundsAmount + * @param integer $transferredAmount Initialization value for $this->transferredAmount */ public function __construct() { diff --git a/src/Models/GetBankAccountResponse.php b/src/Models/GetBankAccountResponse.php index 0f94c4a..beb669e 100644 --- a/src/Models/GetBankAccountResponse.php +++ b/src/Models/GetBankAccountResponse.php @@ -119,8 +119,8 @@ class GetBankAccountResponse implements JsonSerializable public $deletedAt; /** - * Recipient - * @var \MundiAPILib\Models\GetRecipientResponse|null $recipient public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Recipient|null $recipient public property */ public $recipient; @@ -141,22 +141,22 @@ class GetBankAccountResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $holderName Initialization value for $this->holderName - * @param string $holderType Initialization value for $this->holderType - * @param string $bank Initialization value for $this->bank - * @param string $branchNumber Initialization value for $this->branchNumber - * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit - * @param string $accountNumber Initialization value for $this->accountNumber - * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit - * @param string $type Initialization value for $this->type - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param \DateTime $deletedAt Initialization value for $this->deletedAt - * @param GetRecipientResponse $recipient Initialization value for $this->recipient - * @param array $metadata Initialization value for $this->metadata - * @param string $pixKey Initialization value for $this->pixKey + * @param string $id Initialization value for $this->id + * @param string $holderName Initialization value for $this->holderName + * @param string $holderType Initialization value for $this->holderType + * @param string $bank Initialization value for $this->bank + * @param string $branchNumber Initialization value for $this->branchNumber + * @param string $branchCheckDigit Initialization value for $this->branchCheckDigit + * @param string $accountNumber Initialization value for $this->accountNumber + * @param string $accountCheckDigit Initialization value for $this->accountCheckDigit + * @param string $type Initialization value for $this->type + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param Recipient $recipient Initialization value for $this->recipient + * @param array $metadata Initialization value for $this->metadata + * @param string $pixKey Initialization value for $this->pixKey */ public function __construct() { diff --git a/src/Models/GetBoletoTransactionResponse.php b/src/Models/GetBoletoTransactionResponse.php index 419e943..4b172a1 100644 --- a/src/Models/GetBoletoTransactionResponse.php +++ b/src/Models/GetBoletoTransactionResponse.php @@ -66,7 +66,7 @@ class GetBoletoTransactionResponse extends GetTransactionResponse implements Jso * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\GetBillingAddressResponse $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress $billingAddress public property */ public $billingAddress; @@ -141,22 +141,22 @@ class GetBoletoTransactionResponse extends GetTransactionResponse implements Jso /** * Constructor to set initial or default values of member properties - * @param string $url Initialization value for $this->url - * @param string $barcode Initialization value for $this->barcode - * @param string $nossoNumero Initialization value for $this->nossoNumero - * @param string $bank Initialization value for $this->bank - * @param string $documentNumber Initialization value for $this->documentNumber - * @param string $instructions Initialization value for $this->instructions - * @param GetBillingAddressResponse $billingAddress Initialization value for $this->billingAddress - * @param \DateTime $dueAt Initialization value for $this->dueAt - * @param string $qrCode Initialization value for $this->qrCode - * @param string $line Initialization value for $this->line - * @param string $pdfPassword Initialization value for $this->pdfPassword - * @param string $pdf Initialization value for $this->pdf - * @param \DateTime $paidAt Initialization value for $this->paidAt - * @param string $paidAmount Initialization value for $this->paidAmount - * @param string $type Initialization value for $this->type - * @param \DateTime $creditAt Initialization value for $this->creditAt + * @param string $url Initialization value for $this->url + * @param string $barcode Initialization value for $this->barcode + * @param string $nossoNumero Initialization value for $this->nossoNumero + * @param string $bank Initialization value for $this->bank + * @param string $documentNumber Initialization value for $this->documentNumber + * @param string $instructions Initialization value for $this->instructions + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param string $qrCode Initialization value for $this->qrCode + * @param string $line Initialization value for $this->line + * @param string $pdfPassword Initialization value for $this->pdfPassword + * @param string $pdf Initialization value for $this->pdf + * @param \DateTime $paidAt Initialization value for $this->paidAt + * @param string $paidAmount Initialization value for $this->paidAmount + * @param string $type Initialization value for $this->type + * @param \DateTime $creditAt Initialization value for $this->creditAt */ public function __construct() { diff --git a/src/Models/GetCardResponse.php b/src/Models/GetCardResponse.php index 2e46229..4c226cf 100644 --- a/src/Models/GetCardResponse.php +++ b/src/Models/GetCardResponse.php @@ -90,13 +90,13 @@ class GetCardResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\GetBillingAddressResponse $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress $billingAddress public property */ public $billingAddress; /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; @@ -147,23 +147,23 @@ class GetCardResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $lastFourDigits Initialization value for $this->lastFourDigits - * @param string $brand Initialization value for $this->brand - * @param string $holderName Initialization value for $this->holderName - * @param integer $expMonth Initialization value for $this->expMonth - * @param integer $expYear Initialization value for $this->expYear - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetBillingAddressResponse $billingAddress Initialization value for $this->billingAddress - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param array $metadata Initialization value for $this->metadata - * @param string $type Initialization value for $this->type - * @param string $holderDocument Initialization value for $this->holderDocument - * @param \DateTime $deletedAt Initialization value for $this->deletedAt - * @param string $firstSixDigits Initialization value for $this->firstSixDigits - * @param string $label Initialization value for $this->label + * @param string $id Initialization value for $this->id + * @param string $lastFourDigits Initialization value for $this->lastFourDigits + * @param string $brand Initialization value for $this->brand + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param Customer $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param string $type Initialization value for $this->type + * @param string $holderDocument Initialization value for $this->holderDocument + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $firstSixDigits Initialization value for $this->firstSixDigits + * @param string $label Initialization value for $this->label */ public function __construct() { diff --git a/src/Models/GetChargeResponse.php b/src/Models/GetChargeResponse.php index c5498ad..8a27833 100644 --- a/src/Models/GetChargeResponse.php +++ b/src/Models/GetChargeResponse.php @@ -102,19 +102,19 @@ class GetChargeResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetInvoiceResponse|null $invoice public property + * @var \MundiAPILib\Models\Invoice|null $invoice public property */ public $invoice; /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetOrderResponse|null $order public property + * @var \MundiAPILib\Models\Order|null $order public property */ public $order; /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; @@ -184,9 +184,9 @@ class GetChargeResponse implements JsonSerializable * @param \DateTime $createdAt Initialization value for $this->createdAt * @param \DateTime $updatedAt Initialization value for $this->updatedAt * @param GetTransactionResponse $lastTransaction Initialization value for $this->lastTransaction - * @param GetInvoiceResponse $invoice Initialization value for $this->invoice - * @param GetOrderResponse $order Initialization value for $this->order - * @param GetCustomerResponse $customer Initialization value for $this->customer + * @param Invoice $invoice Initialization value for $this->invoice + * @param Order $order Initialization value for $this->order + * @param Customer $customer Initialization value for $this->customer * @param array $metadata Initialization value for $this->metadata * @param \DateTime $paidAt Initialization value for $this->paidAt * @param \DateTime $canceledAt Initialization value for $this->canceledAt diff --git a/src/Models/GetCheckoutCreditCardPaymentResponse.php b/src/Models/GetCheckoutCreditCardPaymentResponse.php index be75968..74ccfc1 100644 --- a/src/Models/GetCheckoutCreditCardPaymentResponse.php +++ b/src/Models/GetCheckoutCreditCardPaymentResponse.php @@ -29,18 +29,17 @@ class GetCheckoutCreditCardPaymentResponse implements JsonSerializable public $installments; /** - * Payment Authentication response + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetPaymentAuthenticationResponse $authentication public property + * @var \MundiAPILib\Models\Authentication $authentication public property */ public $authentication; /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param array $installments Initialization value for $this->installments - * @param GetPaymentAuthenticationResponse $authentication Initialization value for $this->authentication + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param array $installments Initialization value for $this->installments + * @param Authentication $authentication Initialization value for $this->authentication */ public function __construct() { diff --git a/src/Models/GetCheckoutDebitCardPaymentResponse.php b/src/Models/GetCheckoutDebitCardPaymentResponse.php index 4e6ff5a..1aa2e5e 100644 --- a/src/Models/GetCheckoutDebitCardPaymentResponse.php +++ b/src/Models/GetCheckoutDebitCardPaymentResponse.php @@ -23,17 +23,16 @@ class GetCheckoutDebitCardPaymentResponse implements JsonSerializable public $statementDescriptor; /** - * Payment Authentication response object data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetPaymentAuthenticationResponse $authentication public property + * @var \MundiAPILib\Models\Authentication $authentication public property */ public $authentication; /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this- - * >statementDescriptor - * @param GetPaymentAuthenticationResponse $authentication Initialization value for $this->authentication + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Authentication $authentication Initialization value for $this->authentication */ public function __construct() { diff --git a/src/Models/GetCheckoutPaymentResponse.php b/src/Models/GetCheckoutPaymentResponse.php index 3f9be3b..e5dff12 100644 --- a/src/Models/GetCheckoutPaymentResponse.php +++ b/src/Models/GetCheckoutPaymentResponse.php @@ -118,20 +118,20 @@ class GetCheckoutPaymentResponse implements JsonSerializable public $customerEditable; /** - * Dados do comprador - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; /** - * Dados do endereço de cobrança + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetAddressResponse $billingaddress public property + * @var \MundiAPILib\Models\Billingaddress3 $billingaddress public property */ public $billingaddress; /** - * Configurações de cartão de crédito + * @todo Write general description for this property * @required * @maps credit_card * @var \MundiAPILib\Models\GetCheckoutCreditCardPaymentResponse $creditCard public property @@ -139,7 +139,7 @@ class GetCheckoutPaymentResponse implements JsonSerializable public $creditCard; /** - * Configurações de boleto + * @todo Write general description for this property * @required * @var \MundiAPILib\Models\GetCheckoutBoletoPaymentResponse $boleto public property */ @@ -154,9 +154,9 @@ class GetCheckoutPaymentResponse implements JsonSerializable public $billingAddressEditable; /** - * Configurações de entrega + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetShippingResponse $shipping public property + * @var \MundiAPILib\Models\Shipping $shipping public property */ public $shipping; @@ -191,16 +191,16 @@ class GetCheckoutPaymentResponse implements JsonSerializable public $currency; /** - * Configurações de cartão de débito + * @todo Write general description for this property * @maps debit_card * @var \MundiAPILib\Models\GetCheckoutDebitCardPaymentResponse|null $debitCard public property */ public $debitCard; /** - * Bank transfer payment response + * @todo Write general description for this property * @maps bank_transfer - * @var \MundiAPILib\Models\GetCheckoutBankTransferPaymentResponse|null $bankTransfer public property + * @var \MundiAPILib\Models\BankTransfer|null $bankTransfer public property */ public $bankTransfer; @@ -214,54 +214,50 @@ class GetCheckoutPaymentResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param integer $amount Initialization value for $this->amount - * @param string $defaultPaymentMethod Initialization value for $this- - * >defaultPaymentMethod - * @param string $successUrl Initialization value for $this- - * >successUrl - * @param string $paymentUrl Initialization value for $this- - * >paymentUrl - * @param string $gatewayAffiliationId Initialization value for $this- - * >gatewayAffiliationId - * @param array $acceptedPaymentMethods Initialization value for $this- - * >acceptedPaymentMethods - * @param string $status Initialization value for $this->status - * @param bool $skipCheckoutSuccessPage Initialization value for $this- - * >skipCheckoutSuccessPage - * @param \DateTime $createdAt Initialization value for $this- - * >createdAt - * @param \DateTime $updatedAt Initialization value for $this- - * >updatedAt - * @param \DateTime $canceledAt Initialization value for $this- - * >canceledAt - * @param bool $customerEditable Initialization value for $this- - * >customerEditable - * @param GetCustomerResponse $customer Initialization value for $this- - * >customer - * @param GetAddressResponse $billingaddress Initialization value for $this- - * >billingaddress - * @param GetCheckoutCreditCardPaymentResponse $creditCard Initialization value for $this- - * >creditCard - * @param GetCheckoutBoletoPaymentResponse $boleto Initialization value for $this->boleto - * @param bool $billingAddressEditable Initialization value for $this- - * >billingAddressEditable - * @param GetShippingResponse $shipping Initialization value for $this- - * >shipping - * @param bool $shippable Initialization value for $this- - * >shippable - * @param \DateTime $closedAt Initialization value for $this- - * >closedAt - * @param \DateTime $expiresAt Initialization value for $this- - * >expiresAt - * @param string $currency Initialization value for $this- - * >currency - * @param GetCheckoutDebitCardPaymentResponse $debitCard Initialization value for $this- - * >debitCard - * @param GetCheckoutBankTransferPaymentResponse $bankTransfer Initialization value for $this- - * >bankTransfer - * @param array $acceptedBrands Initialization value for $this- - * >acceptedBrands + * @param string $id Initialization value for $this->id + * @param integer $amount Initialization value for $this->amount + * @param string $defaultPaymentMethod Initialization value for $this- + * >defaultPaymentMethod + * @param string $successUrl Initialization value for $this- + * >successUrl + * @param string $paymentUrl Initialization value for $this- + * >paymentUrl + * @param string $gatewayAffiliationId Initialization value for $this- + * >gatewayAffiliationId + * @param array $acceptedPaymentMethods Initialization value for $this- + * >acceptedPaymentMethods + * @param string $status Initialization value for $this->status + * @param bool $skipCheckoutSuccessPage Initialization value for $this- + * >skipCheckoutSuccessPage + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $canceledAt Initialization value for $this- + * >canceledAt + * @param bool $customerEditable Initialization value for $this- + * >customerEditable + * @param Customer $customer Initialization value for $this->customer + * @param Billingaddress3 $billingaddress Initialization value for $this- + * >billingaddress + * @param GetCheckoutCreditCardPaymentResponse $creditCard Initialization value for $this- + * >creditCard + * @param GetCheckoutBoletoPaymentResponse $boleto Initialization value for $this->boleto + * @param bool $billingAddressEditable Initialization value for $this- + * >billingAddressEditable + * @param Shipping $shipping Initialization value for $this->shipping + * @param bool $shippable Initialization value for $this- + * >shippable + * @param \DateTime $closedAt Initialization value for $this->closedAt + * @param \DateTime $expiresAt Initialization value for $this- + * >expiresAt + * @param string $currency Initialization value for $this->currency + * @param GetCheckoutDebitCardPaymentResponse $debitCard Initialization value for $this- + * >debitCard + * @param BankTransfer $bankTransfer Initialization value for $this- + * >bankTransfer + * @param array $acceptedBrands Initialization value for $this- + * >acceptedBrands */ public function __construct() { diff --git a/src/Models/GetCheckoutPaymentSettingsResponse.php b/src/Models/GetCheckoutPaymentSettingsResponse.php index f9022ed..a6e4f8e 100644 --- a/src/Models/GetCheckoutPaymentSettingsResponse.php +++ b/src/Models/GetCheckoutPaymentSettingsResponse.php @@ -46,8 +46,8 @@ class GetCheckoutPaymentSettingsResponse implements JsonSerializable public $status; /** - * Customer - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; @@ -73,14 +73,14 @@ class GetCheckoutPaymentSettingsResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $successUrl Initialization value for $this->successUrl - * @param string $paymentUrl Initialization value for $this->paymentUrl - * @param array $acceptedPaymentMethods Initialization value for $this->acceptedPaymentMethods - * @param string $status Initialization value for $this->status - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param integer $amount Initialization value for $this->amount - * @param string $defaultPaymentMethod Initialization value for $this->defaultPaymentMethod - * @param string $gatewayAffiliationId Initialization value for $this->gatewayAffiliationId + * @param string $successUrl Initialization value for $this->successUrl + * @param string $paymentUrl Initialization value for $this->paymentUrl + * @param array $acceptedPaymentMethods Initialization value for $this->acceptedPaymentMethods + * @param string $status Initialization value for $this->status + * @param Customer $customer Initialization value for $this->customer + * @param integer $amount Initialization value for $this->amount + * @param string $defaultPaymentMethod Initialization value for $this->defaultPaymentMethod + * @param string $gatewayAffiliationId Initialization value for $this->gatewayAffiliationId */ public function __construct() { diff --git a/src/Models/GetCreditCardTransactionResponse.php b/src/Models/GetCreditCardTransactionResponse.php index 3854ae3..3b8c5ae 100644 --- a/src/Models/GetCreditCardTransactionResponse.php +++ b/src/Models/GetCreditCardTransactionResponse.php @@ -74,9 +74,9 @@ class GetCreditCardTransactionResponse extends GetTransactionResponse implements public $operationType; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardResponse $card public property + * @var \MundiAPILib\Models\Card $card public property */ public $card; @@ -112,18 +112,18 @@ class GetCreditCardTransactionResponse extends GetTransactionResponse implements /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param string $acquirerName Initialization value for $this->acquirerName - * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode - * @param string $acquirerTid Initialization value for $this->acquirerTid - * @param string $acquirerNsu Initialization value for $this->acquirerNsu - * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode - * @param string $operationType Initialization value for $this->operationType - * @param GetCardResponse $card Initialization value for $this->card - * @param string $acquirerMessage Initialization value for $this->acquirerMessage - * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode - * @param integer $installments Initialization value for $this->installments - * @param string $threedAuthenticationUrl Initialization value for $this->threedAuthenticationUrl + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $acquirerName Initialization value for $this->acquirerName + * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode + * @param string $acquirerTid Initialization value for $this->acquirerTid + * @param string $acquirerNsu Initialization value for $this->acquirerNsu + * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode + * @param string $operationType Initialization value for $this->operationType + * @param Card $card Initialization value for $this->card + * @param string $acquirerMessage Initialization value for $this->acquirerMessage + * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode + * @param integer $installments Initialization value for $this->installments + * @param string $threedAuthenticationUrl Initialization value for $this->threedAuthenticationUrl */ public function __construct() { diff --git a/src/Models/GetCustomerResponse.php b/src/Models/GetCustomerResponse.php index 6ab517e..41e8325 100644 --- a/src/Models/GetCustomerResponse.php +++ b/src/Models/GetCustomerResponse.php @@ -86,7 +86,7 @@ class GetCustomerResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetAddressResponse $address public property + * @var \MundiAPILib\Models\Address $address public property */ public $address; @@ -128,21 +128,21 @@ class GetCustomerResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $name Initialization value for $this->name - * @param string $email Initialization value for $this->email - * @param bool $delinquent Initialization value for $this->delinquent - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param string $document Initialization value for $this->document - * @param string $type Initialization value for $this->type - * @param string $fbAccessToken Initialization value for $this->fbAccessToken - * @param GetAddressResponse $address Initialization value for $this->address - * @param array $metadata Initialization value for $this->metadata - * @param GetPhonesResponse $phones Initialization value for $this->phones - * @param integer $fbId Initialization value for $this->fbId - * @param string $code Initialization value for $this->code - * @param string $documentType Initialization value for $this->documentType + * @param string $id Initialization value for $this->id + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param bool $delinquent Initialization value for $this->delinquent + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param string $fbAccessToken Initialization value for $this->fbAccessToken + * @param Address $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param GetPhonesResponse $phones Initialization value for $this->phones + * @param integer $fbId Initialization value for $this->fbId + * @param string $code Initialization value for $this->code + * @param string $documentType Initialization value for $this->documentType */ public function __construct() { diff --git a/src/Models/GetDebitCardTransactionResponse.php b/src/Models/GetDebitCardTransactionResponse.php index b4becf5..20fdca2 100644 --- a/src/Models/GetDebitCardTransactionResponse.php +++ b/src/Models/GetDebitCardTransactionResponse.php @@ -74,9 +74,9 @@ class GetDebitCardTransactionResponse extends GetTransactionResponse implements public $operationType; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardResponse $card public property + * @var \MundiAPILib\Models\Card $card public property */ public $card; @@ -128,20 +128,20 @@ class GetDebitCardTransactionResponse extends GetTransactionResponse implements /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param string $acquirerName Initialization value for $this->acquirerName - * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode - * @param string $acquirerTid Initialization value for $this->acquirerTid - * @param string $acquirerNsu Initialization value for $this->acquirerNsu - * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode - * @param string $operationType Initialization value for $this->operationType - * @param GetCardResponse $card Initialization value for $this->card - * @param string $acquirerMessage Initialization value for $this->acquirerMessage - * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode - * @param string $mpi Initialization value for $this->mpi - * @param string $eci Initialization value for $this->eci - * @param string $authenticationType Initialization value for $this->authenticationType - * @param string $threedAuthenticationUrl Initialization value for $this->threedAuthenticationUrl + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $acquirerName Initialization value for $this->acquirerName + * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode + * @param string $acquirerTid Initialization value for $this->acquirerTid + * @param string $acquirerNsu Initialization value for $this->acquirerNsu + * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode + * @param string $operationType Initialization value for $this->operationType + * @param Card $card Initialization value for $this->card + * @param string $acquirerMessage Initialization value for $this->acquirerMessage + * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode + * @param string $mpi Initialization value for $this->mpi + * @param string $eci Initialization value for $this->eci + * @param string $authenticationType Initialization value for $this->authenticationType + * @param string $threedAuthenticationUrl Initialization value for $this->threedAuthenticationUrl */ public function __construct() { diff --git a/src/Models/GetDiscountResponse.php b/src/Models/GetDiscountResponse.php index 423fb7a..981f91e 100644 --- a/src/Models/GetDiscountResponse.php +++ b/src/Models/GetDiscountResponse.php @@ -80,7 +80,7 @@ class GetDiscountResponse implements JsonSerializable public $subscription; /** - * The subscription item + * @todo Write general description for this property * @maps subscription_item * @var \MundiAPILib\Models\GetSubscriptionItemResponse|null $subscriptionItem public property */ diff --git a/src/Models/GetIncrementResponse.php b/src/Models/GetIncrementResponse.php index 4d0126c..082c6e5 100644 --- a/src/Models/GetIncrementResponse.php +++ b/src/Models/GetIncrementResponse.php @@ -80,7 +80,7 @@ class GetIncrementResponse implements JsonSerializable public $subscription; /** - * The Subscription Item + * @todo Write general description for this property * @maps subscription_item * @var \MundiAPILib\Models\GetSubscriptionItemResponse|null $subscriptionItem public property */ diff --git a/src/Models/GetInvoiceItemResponse.php b/src/Models/GetInvoiceItemResponse.php index 3c8018c..e74d070 100644 --- a/src/Models/GetInvoiceItemResponse.php +++ b/src/Models/GetInvoiceItemResponse.php @@ -32,7 +32,7 @@ class GetInvoiceItemResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\GetPricingSchemeResponse $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme $pricingScheme public property */ public $pricingScheme; @@ -40,7 +40,7 @@ class GetInvoiceItemResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps price_bracket - * @var \MundiAPILib\Models\GetPriceBracketResponse $priceBracket public property + * @var \MundiAPILib\Models\PriceBracket $priceBracket public property */ public $priceBracket; @@ -66,13 +66,13 @@ class GetInvoiceItemResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $amount Initialization value for $this->amount - * @param string $description Initialization value for $this->description - * @param GetPricingSchemeResponse $pricingScheme Initialization value for $this->pricingScheme - * @param GetPriceBracketResponse $priceBracket Initialization value for $this->priceBracket - * @param integer $quantity Initialization value for $this->quantity - * @param string $name Initialization value for $this->name - * @param string $subscriptionItemId Initialization value for $this->subscriptionItemId + * @param integer $amount Initialization value for $this->amount + * @param string $description Initialization value for $this->description + * @param PricingScheme $pricingScheme Initialization value for $this->pricingScheme + * @param PriceBracket $priceBracket Initialization value for $this->priceBracket + * @param integer $quantity Initialization value for $this->quantity + * @param string $name Initialization value for $this->name + * @param string $subscriptionItemId Initialization value for $this->subscriptionItemId */ public function __construct() { diff --git a/src/Models/GetInvoiceResponse.php b/src/Models/GetInvoiceResponse.php index 1f2810e..38ccc2d 100644 --- a/src/Models/GetInvoiceResponse.php +++ b/src/Models/GetInvoiceResponse.php @@ -76,14 +76,14 @@ class GetInvoiceResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetChargeResponse $charge public property + * @var \MundiAPILib\Models\Charge $charge public property */ public $charge; @@ -98,7 +98,7 @@ class GetInvoiceResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\GetBillingAddressResponse $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress $billingAddress public property */ public $billingAddress; @@ -111,14 +111,14 @@ class GetInvoiceResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetPeriodResponse|null $cycle public property + * @var \MundiAPILib\Models\Cycle|null $cycle public property */ public $cycle; /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetShippingResponse $shipping public property + * @var \MundiAPILib\Models\Shipping $shipping public property */ public $shipping; @@ -185,29 +185,29 @@ class GetInvoiceResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $code Initialization value for $this->code - * @param string $url Initialization value for $this->url - * @param integer $amount Initialization value for $this->amount - * @param string $status Initialization value for $this->status - * @param string $paymentMethod Initialization value for $this->paymentMethod - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param array $items Initialization value for $this->items - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param GetChargeResponse $charge Initialization value for $this->charge - * @param integer $installments Initialization value for $this->installments - * @param GetBillingAddressResponse $billingAddress Initialization value for $this->billingAddress - * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription - * @param GetPeriodResponse $cycle Initialization value for $this->cycle - * @param GetShippingResponse $shipping Initialization value for $this->shipping - * @param array $metadata Initialization value for $this->metadata - * @param \DateTime $dueAt Initialization value for $this->dueAt - * @param \DateTime $canceledAt Initialization value for $this->canceledAt - * @param \DateTime $billingAt Initialization value for $this->billingAt - * @param \DateTime $seenAt Initialization value for $this->seenAt - * @param integer $totalDiscount Initialization value for $this->totalDiscount - * @param integer $totalIncrement Initialization value for $this->totalIncrement - * @param string $subscriptionId Initialization value for $this->subscriptionId + * @param string $id Initialization value for $this->id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId */ public function __construct() { diff --git a/src/Models/GetOrderResponse.php b/src/Models/GetOrderResponse.php index 8195b8d..2c02d9a 100644 --- a/src/Models/GetOrderResponse.php +++ b/src/Models/GetOrderResponse.php @@ -45,7 +45,7 @@ class GetOrderResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; @@ -92,7 +92,7 @@ class GetOrderResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetShippingResponse $shipping public property + * @var \MundiAPILib\Models\Shipping $shipping public property */ public $shipping; @@ -123,14 +123,14 @@ class GetOrderResponse implements JsonSerializable public $sessionId; /** - * Location - * @var \MundiAPILib\Models\GetLocationResponse|null $location public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Location|null $location public property */ public $location; /** - * Device's informations - * @var \MundiAPILib\Models\GetDeviceResponse|null $device public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Device|null $device public property */ public $device; @@ -143,24 +143,24 @@ class GetOrderResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $code Initialization value for $this->code - * @param string $currency Initialization value for $this->currency - * @param array $items Initialization value for $this->items - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param array $charges Initialization value for $this->charges - * @param string $invoiceUrl Initialization value for $this->invoiceUrl - * @param GetShippingResponse $shipping Initialization value for $this->shipping - * @param array $metadata Initialization value for $this->metadata - * @param array $checkouts Initialization value for $this->checkouts - * @param string $ip Initialization value for $this->ip - * @param string $sessionId Initialization value for $this->sessionId - * @param GetLocationResponse $location Initialization value for $this->location - * @param GetDeviceResponse $device Initialization value for $this->device - * @param bool $closed Initialization value for $this->closed + * @param string $id Initialization value for $this->id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed */ public function __construct() { diff --git a/src/Models/GetPaymentAuthenticationResponse.php b/src/Models/GetPaymentAuthenticationResponse.php index d277a4a..b94d94e 100644 --- a/src/Models/GetPaymentAuthenticationResponse.php +++ b/src/Models/GetPaymentAuthenticationResponse.php @@ -22,17 +22,17 @@ class GetPaymentAuthenticationResponse implements JsonSerializable public $type; /** - * 3D-S payment authentication response + * @todo Write general description for this property * @required * @maps threed_secure - * @var \MundiAPILib\Models\GetThreeDSecureResponse $threedSecure public property + * @var \MundiAPILib\Models\ThreedSecure $threedSecure public property */ public $threedSecure; /** * Constructor to set initial or default values of member properties - * @param string $type Initialization value for $this->type - * @param GetThreeDSecureResponse $threedSecure Initialization value for $this->threedSecure + * @param string $type Initialization value for $this->type + * @param ThreedSecure $threedSecure Initialization value for $this->threedSecure */ public function __construct() { diff --git a/src/Models/GetPixPayerResponse.php b/src/Models/GetPixPayerResponse.php index b838028..c5a9fde 100644 --- a/src/Models/GetPixPayerResponse.php +++ b/src/Models/GetPixPayerResponse.php @@ -35,17 +35,18 @@ class GetPixPayerResponse implements JsonSerializable /** * @todo Write general description for this property + * @required * @maps bank_account - * @var \MundiAPILib\Models\GetPixBankAccountResponse|null $bankAccount public property + * @var object $bankAccount public property */ public $bankAccount; /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $document Initialization value for $this->document - * @param string $documentType Initialization value for $this->documentType - * @param GetPixBankAccountResponse $bankAccount Initialization value for $this->bankAccount + * @param string $name Initialization value for $this->name + * @param string $document Initialization value for $this->document + * @param string $documentType Initialization value for $this->documentType + * @param object $bankAccount Initialization value for $this->bankAccount */ public function __construct() { diff --git a/src/Models/GetPixTransactionResponse.php b/src/Models/GetPixTransactionResponse.php index ef75d68..9601050 100644 --- a/src/Models/GetPixTransactionResponse.php +++ b/src/Models/GetPixTransactionResponse.php @@ -53,17 +53,18 @@ class GetPixTransactionResponse extends GetTransactionResponse implements JsonSe /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetPixPayerResponse|null $payer public property + * @required + * @var object $payer public property */ public $payer; /** * Constructor to set initial or default values of member properties - * @param string $qrCode Initialization value for $this->qrCode - * @param string $qrCodeUrl Initialization value for $this->qrCodeUrl - * @param \DateTime $expiresAt Initialization value for $this->expiresAt - * @param array $additionalInformation Initialization value for $this->additionalInformation - * @param GetPixPayerResponse $payer Initialization value for $this->payer + * @param string $qrCode Initialization value for $this->qrCode + * @param string $qrCodeUrl Initialization value for $this->qrCodeUrl + * @param \DateTime $expiresAt Initialization value for $this->expiresAt + * @param array $additionalInformation Initialization value for $this->additionalInformation + * @param object $payer Initialization value for $this->payer */ public function __construct() { diff --git a/src/Models/GetPlanItemResponse.php b/src/Models/GetPlanItemResponse.php index 427a1fd..b6be3b4 100644 --- a/src/Models/GetPlanItemResponse.php +++ b/src/Models/GetPlanItemResponse.php @@ -58,7 +58,7 @@ class GetPlanItemResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\GetPricingSchemeResponse $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme $pricingScheme public property */ public $pricingScheme; @@ -72,7 +72,7 @@ class GetPlanItemResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetPlanResponse $plan public property + * @var \MundiAPILib\Models\Plan $plan public property */ public $plan; @@ -98,17 +98,17 @@ class GetPlanItemResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $name Initialization value for $this->name - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetPricingSchemeResponse $pricingScheme Initialization value for $this->pricingScheme - * @param string $description Initialization value for $this->description - * @param GetPlanResponse $plan Initialization value for $this->plan - * @param integer $quantity Initialization value for $this->quantity - * @param integer $cycles Initialization value for $this->cycles - * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $id Initialization value for $this->id + * @param string $name Initialization value for $this->name + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param PricingScheme $pricingScheme Initialization value for $this->pricingScheme + * @param string $description Initialization value for $this->description + * @param Plan $plan Initialization value for $this->plan + * @param integer $quantity Initialization value for $this->quantity + * @param integer $cycles Initialization value for $this->cycles + * @param \DateTime $deletedAt Initialization value for $this->deletedAt */ public function __construct() { diff --git a/src/Models/GetPrivateLabelTransactionResponse.php b/src/Models/GetPrivateLabelTransactionResponse.php index 10d05e5..e8a2612 100644 --- a/src/Models/GetPrivateLabelTransactionResponse.php +++ b/src/Models/GetPrivateLabelTransactionResponse.php @@ -74,9 +74,9 @@ class GetPrivateLabelTransactionResponse extends GetTransactionResponse implemen public $operationType; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardResponse $card public property + * @var \MundiAPILib\Models\Card $card public property */ public $card; @@ -104,17 +104,17 @@ class GetPrivateLabelTransactionResponse extends GetTransactionResponse implemen /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param string $acquirerName Initialization value for $this->acquirerName - * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode - * @param string $acquirerTid Initialization value for $this->acquirerTid - * @param string $acquirerNsu Initialization value for $this->acquirerNsu - * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode - * @param string $operationType Initialization value for $this->operationType - * @param GetCardResponse $card Initialization value for $this->card - * @param string $acquirerMessage Initialization value for $this->acquirerMessage - * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode - * @param integer $installments Initialization value for $this->installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $acquirerName Initialization value for $this->acquirerName + * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode + * @param string $acquirerTid Initialization value for $this->acquirerTid + * @param string $acquirerNsu Initialization value for $this->acquirerNsu + * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode + * @param string $operationType Initialization value for $this->operationType + * @param Card $card Initialization value for $this->card + * @param string $acquirerMessage Initialization value for $this->acquirerMessage + * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode + * @param integer $installments Initialization value for $this->installments */ public function __construct() { diff --git a/src/Models/GetRecipientResponse.php b/src/Models/GetRecipientResponse.php index 0c147e4..d116fd1 100644 --- a/src/Models/GetRecipientResponse.php +++ b/src/Models/GetRecipientResponse.php @@ -92,10 +92,10 @@ class GetRecipientResponse implements JsonSerializable public $deletedAt; /** - * Default bank account + * @todo Write general description for this property * @required * @maps default_bank_account - * @var \MundiAPILib\Models\GetBankAccountResponse $defaultBankAccount public property + * @var \MundiAPILib\Models\DefaultBankAccount $defaultBankAccount public property */ public $defaultBankAccount; @@ -117,7 +117,7 @@ class GetRecipientResponse implements JsonSerializable /** * @todo Write general description for this property * @maps automatic_anticipation_settings - * @var \MundiAPILib\Models\GetAutomaticAnticipationResponse|null $automaticAnticipationSettings public property + * @var \MundiAPILib\Models\CreateAutomaticAnticipationSettingsRequest|null $automaticAnticipationSettings public property */ public $automaticAnticipationSettings; @@ -145,61 +145,61 @@ class GetRecipientResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $name Initialization value for $this->name - * @param string $email Initialization value for $this->email - * @param string $document Initialization value for $this- - * >document - * @param string $description Initialization value for $this- - * >description - * @param string $type Initialization value for $this->type - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this- - * >createdAt - * @param \DateTime $updatedAt Initialization value for $this- - * >updatedAt - * @param \DateTime $deletedAt Initialization value for $this- - * >deletedAt - * @param GetBankAccountResponse $defaultBankAccount Initialization value for $this- - * >defaultBankAccount - * @param array $gatewayRecipients Initialization value for $this- - * >gatewayRecipients - * @param array $metadata Initialization value for $this- - * >metadata - * @param GetAutomaticAnticipationResponse $automaticAnticipationSettings Initialization value for $this- - * >automaticAnticipationSettings - * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- - * >transferSettings - * @param string $code Initialization value for $this->code - * @param string $paymentMode Initialization value for $this- - * >paymentMode + * @param string $id Initialization value for $this- + * >id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode */ public function __construct() { - switch (func_num_args()) { - case 17: - $this->id = func_get_arg(0); - $this->name = func_get_arg(1); - $this->email = func_get_arg(2); - $this->document = func_get_arg(3); - $this->description = func_get_arg(4); - $this->type = func_get_arg(5); - $this->status = func_get_arg(6); - $this->createdAt = func_get_arg(7); - $this->updatedAt = func_get_arg(8); - $this->deletedAt = func_get_arg(9); - $this->defaultBankAccount = func_get_arg(10); - $this->gatewayRecipients = func_get_arg(11); - $this->metadata = func_get_arg(12); - $this->automaticAnticipationSettings = func_get_arg(13); - $this->transferSettings = func_get_arg(14); - $this->code = func_get_arg(15); - $this->paymentMode = func_get_arg(16); - break; - - default: - $this->paymentMode = 'bank_transfer'; - break; + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); } } diff --git a/src/Models/GetShippingResponse.php b/src/Models/GetShippingResponse.php index 71a0d17..621a391 100644 --- a/src/Models/GetShippingResponse.php +++ b/src/Models/GetShippingResponse.php @@ -48,7 +48,7 @@ class GetShippingResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetAddressResponse $address public property + * @var \MundiAPILib\Models\Address $address public property */ public $address; @@ -77,14 +77,14 @@ class GetShippingResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param integer $amount Initialization value for $this->amount - * @param string $description Initialization value for $this->description - * @param string $recipientName Initialization value for $this->recipientName - * @param string $recipientPhone Initialization value for $this->recipientPhone - * @param GetAddressResponse $address Initialization value for $this->address - * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate - * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate - * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + * @param string $description Initialization value for $this->description + * @param string $recipientName Initialization value for $this->recipientName + * @param string $recipientPhone Initialization value for $this->recipientPhone + * @param Address $address Initialization value for $this->address + * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate + * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate + * @param string $type Initialization value for $this->type */ public function __construct() { diff --git a/src/Models/GetSplitResponse.php b/src/Models/GetSplitResponse.php index 49e07a6..2abfb8e 100644 --- a/src/Models/GetSplitResponse.php +++ b/src/Models/GetSplitResponse.php @@ -29,8 +29,8 @@ class GetSplitResponse implements JsonSerializable public $amount; /** - * Recipient - * @var \MundiAPILib\Models\GetRecipientResponse|null $recipient public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Recipient|null $recipient public property */ public $recipient; @@ -59,7 +59,7 @@ class GetSplitResponse implements JsonSerializable * Constructor to set initial or default values of member properties * @param string $type Initialization value for $this->type * @param integer $amount Initialization value for $this->amount - * @param GetRecipientResponse $recipient Initialization value for $this->recipient + * @param Recipient $recipient Initialization value for $this->recipient * @param string $gatewayId Initialization value for $this->gatewayId * @param GetSplitOptionsResponse $options Initialization value for $this->options * @param string $id Initialization value for $this->id diff --git a/src/Models/GetSubscriptionItemResponse.php b/src/Models/GetSubscriptionItemResponse.php index 65640e8..b8bb5a5 100644 --- a/src/Models/GetSubscriptionItemResponse.php +++ b/src/Models/GetSubscriptionItemResponse.php @@ -58,7 +58,7 @@ class GetSubscriptionItemResponse implements JsonSerializable * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\GetPricingSchemeResponse $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme $pricingScheme public property */ public $pricingScheme; @@ -112,19 +112,19 @@ class GetSubscriptionItemResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $description Initialization value for $this->description - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetPricingSchemeResponse $pricingScheme Initialization value for $this->pricingScheme - * @param array $discounts Initialization value for $this->discounts - * @param array $increments Initialization value for $this->increments - * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription - * @param string $name Initialization value for $this->name - * @param integer $quantity Initialization value for $this->quantity - * @param integer $cycles Initialization value for $this->cycles - * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $id Initialization value for $this->id + * @param string $description Initialization value for $this->description + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param PricingScheme $pricingScheme Initialization value for $this->pricingScheme + * @param array $discounts Initialization value for $this->discounts + * @param array $increments Initialization value for $this->increments + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param string $name Initialization value for $this->name + * @param integer $quantity Initialization value for $this->quantity + * @param integer $cycles Initialization value for $this->cycles + * @param \DateTime $deletedAt Initialization value for $this->deletedAt */ public function __construct() { diff --git a/src/Models/GetSubscriptionResponse.php b/src/Models/GetSubscriptionResponse.php index 7fecdd4..95400ac 100644 --- a/src/Models/GetSubscriptionResponse.php +++ b/src/Models/GetSubscriptionResponse.php @@ -64,7 +64,7 @@ class GetSubscriptionResponse implements JsonSerializable /** * @todo Write general description for this property * @maps current_cycle - * @var \MundiAPILib\Models\GetPeriodResponse|null $currentCycle public property + * @var \MundiAPILib\Models\CurrentCycle|null $currentCycle public property */ public $currentCycle; @@ -117,14 +117,14 @@ class GetSubscriptionResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetCustomerResponse|null $customer public property + * @var \MundiAPILib\Models\Customer|null $customer public property */ public $customer; /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardResponse $card public property + * @var \MundiAPILib\Models\Card $card public property */ public $card; @@ -153,7 +153,7 @@ class GetSubscriptionResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetSetupResponse $setup public property + * @var \MundiAPILib\Models\Setup $setup public property */ public $setup; @@ -216,43 +216,42 @@ class GetSubscriptionResponse implements JsonSerializable public $boletoDueDays; /** - * Subscription's split response + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetSubscriptionSplitResponse $split public property + * @var \MundiAPILib\Models\Split $split public property */ public $split; /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $code Initialization value for $this->code - * @param \DateTime $startAt Initialization value for $this->startAt - * @param string $interval Initialization value for $this->interval - * @param integer $intervalCount Initialization value for $this->intervalCount - * @param string $billingType Initialization value for $this->billingType - * @param GetPeriodResponse $currentCycle Initialization value for $this->currentCycle - * @param string $paymentMethod Initialization value for $this->paymentMethod - * @param string $currency Initialization value for $this->currency - * @param integer $installments Initialization value for $this->installments - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetCustomerResponse $customer Initialization value for $this->customer - * @param GetCardResponse $card Initialization value for $this->card - * @param array $items Initialization value for $this->items - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param array $metadata Initialization value for $this->metadata - * @param GetSetupResponse $setup Initialization value for $this->setup - * @param string $gatewayAffiliationId Initialization value for $this- - * >gatewayAffiliationId - * @param \DateTime $nextBillingAt Initialization value for $this->nextBillingAt - * @param integer $billingDay Initialization value for $this->billingDay - * @param integer $minimumPrice Initialization value for $this->minimumPrice - * @param \DateTime $canceledAt Initialization value for $this->canceledAt - * @param array $discounts Initialization value for $this->discounts - * @param array $increments Initialization value for $this->increments - * @param integer $boletoDueDays Initialization value for $this->boletoDueDays - * @param GetSubscriptionSplitResponse $split Initialization value for $this->split + * @param string $id Initialization value for $this->id + * @param string $code Initialization value for $this->code + * @param \DateTime $startAt Initialization value for $this->startAt + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param string $billingType Initialization value for $this->billingType + * @param CurrentCycle $currentCycle Initialization value for $this->currentCycle + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param string $currency Initialization value for $this->currency + * @param integer $installments Initialization value for $this->installments + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param Customer $customer Initialization value for $this->customer + * @param Card $card Initialization value for $this->card + * @param array $items Initialization value for $this->items + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param array $metadata Initialization value for $this->metadata + * @param Setup $setup Initialization value for $this->setup + * @param string $gatewayAffiliationId Initialization value for $this->gatewayAffiliationId + * @param \DateTime $nextBillingAt Initialization value for $this->nextBillingAt + * @param integer $billingDay Initialization value for $this->billingDay + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param array $discounts Initialization value for $this->discounts + * @param array $increments Initialization value for $this->increments + * @param integer $boletoDueDays Initialization value for $this->boletoDueDays + * @param Split $split Initialization value for $this->split */ public function __construct() { diff --git a/src/Models/GetTokenResponse.php b/src/Models/GetTokenResponse.php index 8991c74..c7e3cd3 100644 --- a/src/Models/GetTokenResponse.php +++ b/src/Models/GetTokenResponse.php @@ -49,17 +49,17 @@ class GetTokenResponse implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardTokenResponse $card public property + * @var \MundiAPILib\Models\Card9 $card public property */ public $card; /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param string $type Initialization value for $this->type - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param string $expiresAt Initialization value for $this->expiresAt - * @param GetCardTokenResponse $card Initialization value for $this->card + * @param string $id Initialization value for $this->id + * @param string $type Initialization value for $this->type + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param string $expiresAt Initialization value for $this->expiresAt + * @param Card9 $card Initialization value for $this->card */ public function __construct() { diff --git a/src/Models/GetTransactionResponse.php b/src/Models/GetTransactionResponse.php index 04f2f96..9bd6f9b 100644 --- a/src/Models/GetTransactionResponse.php +++ b/src/Models/GetTransactionResponse.php @@ -14,7 +14,7 @@ *Generic response object for getting a transaction. * * @discriminator transaction_type - * @discriminatorType transaction + * @discriminatorType GetTransactionResponse */ class GetTransactionResponse implements JsonSerializable { @@ -111,10 +111,10 @@ class GetTransactionResponse implements JsonSerializable public $id; /** - * The Gateway Response + * @todo Write general description for this property * @required * @maps gateway_response - * @var \MundiAPILib\Models\GetGatewayResponseResponse $gatewayResponse public property + * @var \MundiAPILib\Models\GatewayResponse $gatewayResponse public property */ public $gatewayResponse; @@ -141,13 +141,13 @@ class GetTransactionResponse implements JsonSerializable /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetInterestResponse|null $interest public property + * @var \MundiAPILib\Models\Interest|null $interest public property */ public $interest; /** * @todo Write general description for this property - * @var \MundiAPILib\Models\GetFineResponse|null $fine public property + * @var \MundiAPILib\Models\Fine|null $fine public property */ public $fine; @@ -160,25 +160,25 @@ class GetTransactionResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $gatewayId Initialization value for $this->gatewayId - * @param integer $amount Initialization value for $this->amount - * @param string $status Initialization value for $this->status - * @param bool $success Initialization value for $this->success - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param integer $attemptCount Initialization value for $this->attemptCount - * @param integer $maxAttempts Initialization value for $this->maxAttempts - * @param array $splits Initialization value for $this->splits - * @param \DateTime $nextAttempt Initialization value for $this->nextAttempt - * @param string $transactionType Initialization value for $this->transactionType - * @param string $id Initialization value for $this->id - * @param GetGatewayResponseResponse $gatewayResponse Initialization value for $this->gatewayResponse - * @param GetAntifraudResponse $antifraudResponse Initialization value for $this->antifraudResponse - * @param array $metadata Initialization value for $this->metadata - * @param array $split Initialization value for $this->split - * @param GetInterestResponse $interest Initialization value for $this->interest - * @param GetFineResponse $fine Initialization value for $this->fine - * @param integer $maxDaysToPayPastDue Initialization value for $this->maxDaysToPayPastDue + * @param string $gatewayId Initialization value for $this->gatewayId + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param bool $success Initialization value for $this->success + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param integer $attemptCount Initialization value for $this->attemptCount + * @param integer $maxAttempts Initialization value for $this->maxAttempts + * @param array $splits Initialization value for $this->splits + * @param \DateTime $nextAttempt Initialization value for $this->nextAttempt + * @param string $transactionType Initialization value for $this->transactionType + * @param string $id Initialization value for $this->id + * @param GatewayResponse $gatewayResponse Initialization value for $this->gatewayResponse + * @param GetAntifraudResponse $antifraudResponse Initialization value for $this->antifraudResponse + * @param array $metadata Initialization value for $this->metadata + * @param array $split Initialization value for $this->split + * @param Interest $interest Initialization value for $this->interest + * @param Fine $fine Initialization value for $this->fine + * @param integer $maxDaysToPayPastDue Initialization value for $this->maxDaysToPayPastDue */ public function __construct() { diff --git a/src/Models/GetTransfer.php b/src/Models/GetTransfer.php index 1c66b8b..b368f05 100644 --- a/src/Models/GetTransfer.php +++ b/src/Models/GetTransfer.php @@ -100,14 +100,14 @@ class GetTransfer implements JsonSerializable /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetTransferSourceResponse $source public property + * @var \MundiAPILib\Models\GetWithdrawSourceResponse $source public property */ public $source; /** * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetTransferTargetResponse $target public property + * @var \MundiAPILib\Models\GetWithdrawTargetResponse $target public property */ public $target; @@ -124,8 +124,8 @@ class GetTransfer implements JsonSerializable * @param \DateTime $fundingDate Initialization value for $this->fundingDate * @param \DateTime $fundingEstimatedDate Initialization value for $this->fundingEstimatedDate * @param string $type Initialization value for $this->type - * @param GetTransferSourceResponse $source Initialization value for $this->source - * @param GetTransferTargetResponse $target Initialization value for $this->target + * @param GetWithdrawSourceResponse $source Initialization value for $this->source + * @param GetWithdrawTargetResponse $target Initialization value for $this->target */ public function __construct() { diff --git a/src/Models/GetTransferResponse.php b/src/Models/GetTransferResponse.php index a2f17d1..43b72f1 100644 --- a/src/Models/GetTransferResponse.php +++ b/src/Models/GetTransferResponse.php @@ -55,10 +55,10 @@ class GetTransferResponse implements JsonSerializable public $updatedAt; /** - * Bank account + * @todo Write general description for this property * @required * @maps bank_account - * @var \MundiAPILib\Models\GetBankAccountResponse $bankAccount public property + * @var \MundiAPILib\Models\BankAccount $bankAccount public property */ public $bankAccount; @@ -71,13 +71,13 @@ class GetTransferResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $id Initialization value for $this->id - * @param integer $amount Initialization value for $this->amount - * @param string $status Initialization value for $this->status - * @param \DateTime $createdAt Initialization value for $this->createdAt - * @param \DateTime $updatedAt Initialization value for $this->updatedAt - * @param GetBankAccountResponse $bankAccount Initialization value for $this->bankAccount - * @param array $metadata Initialization value for $this->metadata + * @param string $id Initialization value for $this->id + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BankAccount $bankAccount Initialization value for $this->bankAccount + * @param array $metadata Initialization value for $this->metadata */ public function __construct() { diff --git a/src/Models/GetUsageResponse.php b/src/Models/GetUsageResponse.php index 5d3b403..8e92b33 100644 --- a/src/Models/GetUsageResponse.php +++ b/src/Models/GetUsageResponse.php @@ -70,7 +70,7 @@ class GetUsageResponse implements JsonSerializable public $deletedAt; /** - * Subscription item + * @todo Write general description for this property * @required * @maps subscription_item * @var \MundiAPILib\Models\GetSubscriptionItemResponse $subscriptionItem public property diff --git a/src/Models/GetUsagesDetailsResponse.php b/src/Models/GetUsagesDetailsResponse.php index 15cbf1f..9f88672 100644 --- a/src/Models/GetUsagesDetailsResponse.php +++ b/src/Models/GetUsagesDetailsResponse.php @@ -31,17 +31,17 @@ class GetUsagesDetailsResponse implements JsonSerializable public $totalAmount; /** - * Period Details + * @todo Write general description for this property * @maps Period - * @var \MundiAPILib\Models\GetPeriodResponse|null $period public property + * @var \MundiAPILib\Models\Period|null $period public property */ public $period; /** - * Usages Details + * @todo Write general description for this property * @required * @maps Usages - * @var \MundiAPILib\Models\ListUsagesDetailsResponse $usages public property + * @var \MundiAPILib\Models\Usages $usages public property */ public $usages; @@ -61,12 +61,12 @@ class GetUsagesDetailsResponse implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $subscriptionId Initialization value for $this->subscriptionId - * @param integer $totalAmount Initialization value for $this->totalAmount - * @param GetPeriodResponse $period Initialization value for $this->period - * @param ListUsagesDetailsResponse $usages Initialization value for $this->usages - * @param integer $totalDiscount Initialization value for $this->totalDiscount - * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + * @param integer $totalAmount Initialization value for $this->totalAmount + * @param Period $period Initialization value for $this->period + * @param Usages $usages Initialization value for $this->usages + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement */ public function __construct() { diff --git a/src/Models/GetVoucherTransactionResponse.php b/src/Models/GetVoucherTransactionResponse.php index 61aea81..5941862 100644 --- a/src/Models/GetVoucherTransactionResponse.php +++ b/src/Models/GetVoucherTransactionResponse.php @@ -90,24 +90,24 @@ class GetVoucherTransactionResponse extends GetTransactionResponse implements Js public $operationType; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\GetCardResponse $card public property + * @var \MundiAPILib\Models\Card $card public property */ public $card; /** * Constructor to set initial or default values of member properties - * @param string $statementDescriptor Initialization value for $this->statementDescriptor - * @param string $acquirerName Initialization value for $this->acquirerName - * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode - * @param string $acquirerTid Initialization value for $this->acquirerTid - * @param string $acquirerNsu Initialization value for $this->acquirerNsu - * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode - * @param string $acquirerMessage Initialization value for $this->acquirerMessage - * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode - * @param string $operationType Initialization value for $this->operationType - * @param GetCardResponse $card Initialization value for $this->card + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $acquirerName Initialization value for $this->acquirerName + * @param string $acquirerAffiliationCode Initialization value for $this->acquirerAffiliationCode + * @param string $acquirerTid Initialization value for $this->acquirerTid + * @param string $acquirerNsu Initialization value for $this->acquirerNsu + * @param string $acquirerAuthCode Initialization value for $this->acquirerAuthCode + * @param string $acquirerMessage Initialization value for $this->acquirerMessage + * @param string $acquirerReturnCode Initialization value for $this->acquirerReturnCode + * @param string $operationType Initialization value for $this->operationType + * @param Card $card Initialization value for $this->card */ public function __construct() { diff --git a/src/Models/GooglePay.php b/src/Models/GooglePay.php new file mode 100644 index 0000000..b33a708 --- /dev/null +++ b/src/Models/GooglePay.php @@ -0,0 +1,87 @@ +version + * @param string $data Initialization value for $this->data + * @param Header1 $header Initialization value for $this->header + * @param string $signature Initialization value for $this->signature + * @param string $merchantIdentifier Initialization value for $this->merchantIdentifier + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->version = func_get_arg(0); + $this->data = func_get_arg(1); + $this->header = func_get_arg(2); + $this->signature = func_get_arg(3); + $this->merchantIdentifier = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['version'] = $this->version; + $json['data'] = $this->data; + $json['header'] = $this->header; + $json['signature'] = $this->signature; + $json['merchant_identifier'] = $this->merchantIdentifier; + + return $json; + } +} diff --git a/src/Models/Header.php b/src/Models/Header.php new file mode 100644 index 0000000..eeb41b5 --- /dev/null +++ b/src/Models/Header.php @@ -0,0 +1,67 @@ +publicKeyHash + * @param string $ephemeralPublicKey Initialization value for $this->ephemeralPublicKey + * @param string $transactionId Initialization value for $this->transactionId + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->publicKeyHash = func_get_arg(0); + $this->ephemeralPublicKey = func_get_arg(1); + $this->transactionId = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['public_key_hash'] = $this->publicKeyHash; + $json['ephemeral_public_key'] = $this->ephemeralPublicKey; + $json['transaction_id'] = $this->transactionId; + + return $json; + } +} diff --git a/src/Models/Header1.php b/src/Models/Header1.php new file mode 100644 index 0000000..271f73d --- /dev/null +++ b/src/Models/Header1.php @@ -0,0 +1,47 @@ +ephemeralPublicKey + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->ephemeralPublicKey = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['ephemeral_public_key'] = $this->ephemeralPublicKey; + + return $json; + } +} diff --git a/src/Models/Interest.php b/src/Models/Interest.php new file mode 100644 index 0000000..fa076a1 --- /dev/null +++ b/src/Models/Interest.php @@ -0,0 +1,66 @@ +days + * @param string $type Initialization value for $this->type + * @param integer $amount Initialization value for $this->amount + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->days = func_get_arg(0); + $this->type = func_get_arg(1); + $this->amount = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['days'] = $this->days; + $json['type'] = $this->type; + $json['amount'] = $this->amount; + + return $json; + } +} diff --git a/src/Models/Invoice.php b/src/Models/Invoice.php new file mode 100644 index 0000000..d26caca --- /dev/null +++ b/src/Models/Invoice.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/InvoicesMetadataRequest.php b/src/Models/InvoicesMetadataRequest.php new file mode 100644 index 0000000..dc9a509 --- /dev/null +++ b/src/Models/InvoicesMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/InvoicesMetadataResponse.php b/src/Models/InvoicesMetadataResponse.php new file mode 100644 index 0000000..8b020d5 --- /dev/null +++ b/src/Models/InvoicesMetadataResponse.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/InvoicesResponse.php b/src/Models/InvoicesResponse.php new file mode 100644 index 0000000..f9be719 --- /dev/null +++ b/src/Models/InvoicesResponse.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/InvoicesResponse2.php b/src/Models/InvoicesResponse2.php new file mode 100644 index 0000000..3cf4ed0 --- /dev/null +++ b/src/Models/InvoicesResponse2.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/InvoicesStatusResponse.php b/src/Models/InvoicesStatusResponse.php new file mode 100644 index 0000000..0d2c83a --- /dev/null +++ b/src/Models/InvoicesStatusResponse.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/ListAccessTokensResponse.php b/src/Models/ListAccessTokensResponse.php index 7d43f88..ddbdc18 100644 --- a/src/Models/ListAccessTokensResponse.php +++ b/src/Models/ListAccessTokensResponse.php @@ -22,16 +22,16 @@ class ListAccessTokensResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListAddressesResponse.php b/src/Models/ListAddressesResponse.php index 61f8e63..b0ee513 100644 --- a/src/Models/ListAddressesResponse.php +++ b/src/Models/ListAddressesResponse.php @@ -22,16 +22,16 @@ class ListAddressesResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListAnticipationResponse.php b/src/Models/ListAnticipationResponse.php index 16bb239..e822280 100644 --- a/src/Models/ListAnticipationResponse.php +++ b/src/Models/ListAnticipationResponse.php @@ -22,16 +22,16 @@ class ListAnticipationResponse implements JsonSerializable public $data; /** - * Paging + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListCardsResponse.php b/src/Models/ListCardsResponse.php index 54e529b..133b7bb 100644 --- a/src/Models/ListCardsResponse.php +++ b/src/Models/ListCardsResponse.php @@ -22,16 +22,16 @@ class ListCardsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListChargeTransactionsResponse.php b/src/Models/ListChargeTransactionsResponse.php index f46e090..6d07ee4 100644 --- a/src/Models/ListChargeTransactionsResponse.php +++ b/src/Models/ListChargeTransactionsResponse.php @@ -22,16 +22,16 @@ class ListChargeTransactionsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListChargesResponse.php b/src/Models/ListChargesResponse.php index 070a3fd..eb2e8f7 100644 --- a/src/Models/ListChargesResponse.php +++ b/src/Models/ListChargesResponse.php @@ -22,16 +22,16 @@ class ListChargesResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListCustomersResponse.php b/src/Models/ListCustomersResponse.php index 9d2e1c7..dfc8e06 100644 --- a/src/Models/ListCustomersResponse.php +++ b/src/Models/ListCustomersResponse.php @@ -22,16 +22,16 @@ class ListCustomersResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListCyclesResponse.php b/src/Models/ListCyclesResponse.php index e7572dc..c9453c8 100644 --- a/src/Models/ListCyclesResponse.php +++ b/src/Models/ListCyclesResponse.php @@ -21,15 +21,15 @@ class ListCyclesResponse implements JsonSerializable public $data; /** - * Paging object - * @var \MundiAPILib\Models\PagingResponse|null $paging public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Paging|null $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListDiscountsResponse.php b/src/Models/ListDiscountsResponse.php index eaf7d0a..5386be2 100644 --- a/src/Models/ListDiscountsResponse.php +++ b/src/Models/ListDiscountsResponse.php @@ -22,16 +22,16 @@ class ListDiscountsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListIncrementsResponse.php b/src/Models/ListIncrementsResponse.php index 720b055..d639a8b 100644 --- a/src/Models/ListIncrementsResponse.php +++ b/src/Models/ListIncrementsResponse.php @@ -22,16 +22,16 @@ class ListIncrementsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListInvoicesResponse.php b/src/Models/ListInvoicesResponse.php index 2e5c2a3..675c512 100644 --- a/src/Models/ListInvoicesResponse.php +++ b/src/Models/ListInvoicesResponse.php @@ -22,16 +22,16 @@ class ListInvoicesResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListOrderResponse.php b/src/Models/ListOrderResponse.php index 825a3b6..5e34450 100644 --- a/src/Models/ListOrderResponse.php +++ b/src/Models/ListOrderResponse.php @@ -22,16 +22,16 @@ class ListOrderResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListPlansResponse.php b/src/Models/ListPlansResponse.php index f291fbb..8aae542 100644 --- a/src/Models/ListPlansResponse.php +++ b/src/Models/ListPlansResponse.php @@ -22,16 +22,16 @@ class ListPlansResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListRecipientResponse.php b/src/Models/ListRecipientResponse.php index b6ccd70..e9f0d85 100644 --- a/src/Models/ListRecipientResponse.php +++ b/src/Models/ListRecipientResponse.php @@ -22,16 +22,16 @@ class ListRecipientResponse implements JsonSerializable public $data; /** - * Paging + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListSubscriptionItemsResponse.php b/src/Models/ListSubscriptionItemsResponse.php index 13648e3..81af43c 100644 --- a/src/Models/ListSubscriptionItemsResponse.php +++ b/src/Models/ListSubscriptionItemsResponse.php @@ -22,16 +22,16 @@ class ListSubscriptionItemsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListSubscriptionsResponse.php b/src/Models/ListSubscriptionsResponse.php index b52823f..0aad941 100644 --- a/src/Models/ListSubscriptionsResponse.php +++ b/src/Models/ListSubscriptionsResponse.php @@ -22,16 +22,16 @@ class ListSubscriptionsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListTransactionsFilesResponse.php b/src/Models/ListTransactionsFilesResponse.php index e9302ec..b0c1369 100644 --- a/src/Models/ListTransactionsFilesResponse.php +++ b/src/Models/ListTransactionsFilesResponse.php @@ -22,16 +22,16 @@ class ListTransactionsFilesResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListTransactionsResponse.php b/src/Models/ListTransactionsResponse.php index 35e737b..d40836f 100644 --- a/src/Models/ListTransactionsResponse.php +++ b/src/Models/ListTransactionsResponse.php @@ -22,16 +22,16 @@ class ListTransactionsResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListTransferResponse.php b/src/Models/ListTransferResponse.php index 89d10dc..b64c42c 100644 --- a/src/Models/ListTransferResponse.php +++ b/src/Models/ListTransferResponse.php @@ -22,16 +22,16 @@ class ListTransferResponse implements JsonSerializable public $data; /** - * Paging + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListTransfers.php b/src/Models/ListTransfers.php index 19f4065..af89024 100644 --- a/src/Models/ListTransfers.php +++ b/src/Models/ListTransfers.php @@ -22,16 +22,16 @@ class ListTransfers implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListUsagesDetailsResponse.php b/src/Models/ListUsagesDetailsResponse.php index d8d5cb6..d5e4621 100644 --- a/src/Models/ListUsagesDetailsResponse.php +++ b/src/Models/ListUsagesDetailsResponse.php @@ -22,16 +22,16 @@ class ListUsagesDetailsResponse implements JsonSerializable public $data; /** - * paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListUsagesResponse.php b/src/Models/ListUsagesResponse.php index bb91107..3e4d3b1 100644 --- a/src/Models/ListUsagesResponse.php +++ b/src/Models/ListUsagesResponse.php @@ -22,16 +22,16 @@ class ListUsagesResponse implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/ListWithdrawals.php b/src/Models/ListWithdrawals.php index 1567870..dc96fa0 100644 --- a/src/Models/ListWithdrawals.php +++ b/src/Models/ListWithdrawals.php @@ -22,16 +22,16 @@ class ListWithdrawals implements JsonSerializable public $data; /** - * Paging object + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\PagingResponse $paging public property + * @var \MundiAPILib\Models\Paging $paging public property */ public $paging; /** * Constructor to set initial or default values of member properties - * @param array $data Initialization value for $this->data - * @param PagingResponse $paging Initialization value for $this->paging + * @param array $data Initialization value for $this->data + * @param Paging $paging Initialization value for $this->paging */ public function __construct() { diff --git a/src/Models/Location.php b/src/Models/Location.php new file mode 100644 index 0000000..1b58046 --- /dev/null +++ b/src/Models/Location.php @@ -0,0 +1,56 @@ +latitude + * @param string $longitude Initialization value for $this->longitude + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->latitude = func_get_arg(0); + $this->longitude = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['latitude'] = $this->latitude; + $json['longitude'] = $this->longitude; + + return $json; + } +} diff --git a/src/Models/Max.php b/src/Models/Max.php new file mode 100644 index 0000000..0dcf01e --- /dev/null +++ b/src/Models/Max.php @@ -0,0 +1,57 @@ +amount + * @param integer $anticipationFee Initialization value for $this->anticipationFee + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->anticipationFee = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['anticipation_fee'] = $this->anticipationFee; + + return $json; + } +} diff --git a/src/Models/Min.php b/src/Models/Min.php new file mode 100644 index 0000000..7e5a0bf --- /dev/null +++ b/src/Models/Min.php @@ -0,0 +1,57 @@ +amount + * @param integer $anticipationFee Initialization value for $this->anticipationFee + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->anticipationFee = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['anticipation_fee'] = $this->anticipationFee; + + return $json; + } +} diff --git a/src/Models/Options1.php b/src/Models/Options1.php new file mode 100644 index 0000000..cbcb252 --- /dev/null +++ b/src/Models/Options1.php @@ -0,0 +1,48 @@ +verifyCard + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->verifyCard = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['verify_card'] = $this->verifyCard; + + return $json; + } +} diff --git a/src/Models/Options2.php b/src/Models/Options2.php new file mode 100644 index 0000000..e0ca20e --- /dev/null +++ b/src/Models/Options2.php @@ -0,0 +1,65 @@ +liable + * @param bool $chargeProcessingFee Initialization value for $this->chargeProcessingFee + * @param bool $chargeRemainderFee Initialization value for $this->chargeRemainderFee + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->liable = func_get_arg(0); + $this->chargeProcessingFee = func_get_arg(1); + $this->chargeRemainderFee = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['liable'] = $this->liable; + $json['charge_processing_fee'] = $this->chargeProcessingFee; + $json['charge_remainder_fee'] = $this->chargeRemainderFee; + + return $json; + } +} diff --git a/src/Models/Order.php b/src/Models/Order.php new file mode 100644 index 0000000..a4224a7 --- /dev/null +++ b/src/Models/Order.php @@ -0,0 +1,217 @@ +id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->currency = func_get_arg(2); + $this->items = func_get_arg(3); + $this->customer = func_get_arg(4); + $this->status = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->updatedAt = func_get_arg(7); + $this->charges = func_get_arg(8); + $this->invoiceUrl = func_get_arg(9); + $this->shipping = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->checkouts = func_get_arg(12); + $this->ip = func_get_arg(13); + $this->sessionId = func_get_arg(14); + $this->location = func_get_arg(15); + $this->device = func_get_arg(16); + $this->closed = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['currency'] = $this->currency; + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['charges'] = $this->charges; + $json['invoice_url'] = $this->invoiceUrl; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['checkouts'] = $this->checkouts; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + + return $json; + } +} diff --git a/src/Models/OrdersClosedResponse.php b/src/Models/OrdersClosedResponse.php new file mode 100644 index 0000000..870e169 --- /dev/null +++ b/src/Models/OrdersClosedResponse.php @@ -0,0 +1,217 @@ +id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->currency = func_get_arg(2); + $this->items = func_get_arg(3); + $this->customer = func_get_arg(4); + $this->status = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->updatedAt = func_get_arg(7); + $this->charges = func_get_arg(8); + $this->invoiceUrl = func_get_arg(9); + $this->shipping = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->checkouts = func_get_arg(12); + $this->ip = func_get_arg(13); + $this->sessionId = func_get_arg(14); + $this->location = func_get_arg(15); + $this->device = func_get_arg(16); + $this->closed = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['currency'] = $this->currency; + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['charges'] = $this->charges; + $json['invoice_url'] = $this->invoiceUrl; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['checkouts'] = $this->checkouts; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + + return $json; + } +} diff --git a/src/Models/OrdersItemsRequest.php b/src/Models/OrdersItemsRequest.php new file mode 100644 index 0000000..721d67a --- /dev/null +++ b/src/Models/OrdersItemsRequest.php @@ -0,0 +1,85 @@ +amount + * @param string $description Initialization value for $this->description + * @param integer $quantity Initialization value for $this->quantity + * @param string $category Initialization value for $this->category + * @param string $code Initialization value for $this->code + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->description = func_get_arg(1); + $this->quantity = func_get_arg(2); + $this->category = func_get_arg(3); + $this->code = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['quantity'] = $this->quantity; + $json['category'] = $this->category; + $json['code'] = $this->code; + + return $json; + } +} diff --git a/src/Models/OrdersItemsRequest1.php b/src/Models/OrdersItemsRequest1.php new file mode 100644 index 0000000..b7b4b5a --- /dev/null +++ b/src/Models/OrdersItemsRequest1.php @@ -0,0 +1,76 @@ +amount + * @param string $description Initialization value for $this->description + * @param integer $quantity Initialization value for $this->quantity + * @param string $category Initialization value for $this->category + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->description = func_get_arg(1); + $this->quantity = func_get_arg(2); + $this->category = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['quantity'] = $this->quantity; + $json['category'] = $this->category; + + return $json; + } +} diff --git a/src/Models/OrdersItemsResponse.php b/src/Models/OrdersItemsResponse.php new file mode 100644 index 0000000..43019e8 --- /dev/null +++ b/src/Models/OrdersItemsResponse.php @@ -0,0 +1,217 @@ +id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->currency = func_get_arg(2); + $this->items = func_get_arg(3); + $this->customer = func_get_arg(4); + $this->status = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->updatedAt = func_get_arg(7); + $this->charges = func_get_arg(8); + $this->invoiceUrl = func_get_arg(9); + $this->shipping = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->checkouts = func_get_arg(12); + $this->ip = func_get_arg(13); + $this->sessionId = func_get_arg(14); + $this->location = func_get_arg(15); + $this->device = func_get_arg(16); + $this->closed = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['currency'] = $this->currency; + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['charges'] = $this->charges; + $json['invoice_url'] = $this->invoiceUrl; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['checkouts'] = $this->checkouts; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + + return $json; + } +} diff --git a/src/Models/OrdersItemsResponse1.php b/src/Models/OrdersItemsResponse1.php new file mode 100644 index 0000000..eeecfbf --- /dev/null +++ b/src/Models/OrdersItemsResponse1.php @@ -0,0 +1,96 @@ +id + * @param integer $amount Initialization value for $this->amount + * @param string $description Initialization value for $this->description + * @param integer $quantity Initialization value for $this->quantity + * @param string $category Initialization value for $this->category + * @param string $code Initialization value for $this->code + */ + public function __construct() + { + if (6 == func_num_args()) { + $this->id = func_get_arg(0); + $this->amount = func_get_arg(1); + $this->description = func_get_arg(2); + $this->quantity = func_get_arg(3); + $this->category = func_get_arg(4); + $this->code = func_get_arg(5); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['quantity'] = $this->quantity; + $json['category'] = $this->category; + $json['code'] = $this->code; + + return $json; + } +} diff --git a/src/Models/OrdersMetadataRequest.php b/src/Models/OrdersMetadataRequest.php new file mode 100644 index 0000000..5e17e6a --- /dev/null +++ b/src/Models/OrdersMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/OrdersMetadataResponse.php b/src/Models/OrdersMetadataResponse.php new file mode 100644 index 0000000..1c6f418 --- /dev/null +++ b/src/Models/OrdersMetadataResponse.php @@ -0,0 +1,217 @@ +id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->currency = func_get_arg(2); + $this->items = func_get_arg(3); + $this->customer = func_get_arg(4); + $this->status = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->updatedAt = func_get_arg(7); + $this->charges = func_get_arg(8); + $this->invoiceUrl = func_get_arg(9); + $this->shipping = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->checkouts = func_get_arg(12); + $this->ip = func_get_arg(13); + $this->sessionId = func_get_arg(14); + $this->location = func_get_arg(15); + $this->device = func_get_arg(16); + $this->closed = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['currency'] = $this->currency; + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['charges'] = $this->charges; + $json['invoice_url'] = $this->invoiceUrl; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['checkouts'] = $this->checkouts; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + + return $json; + } +} diff --git a/src/Models/OrdersRequest.php b/src/Models/OrdersRequest.php new file mode 100644 index 0000000..9820d2d --- /dev/null +++ b/src/Models/OrdersRequest.php @@ -0,0 +1,190 @@ +items + * @param Customer8 $customer Initialization value for $this->customer + * @param array $payments Initialization value for $this->payments + * @param string $code Initialization value for $this->code + * @param string $customerId Initialization value for $this->customerId + * @param Shipping3 $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param bool $antifraudEnabled Initialization value for $this->antifraudEnabled + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device1 $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + * @param string $currency Initialization value for $this->currency + * @param CreateAntifraudRequest $antifraud Initialization value for $this->antifraud + * @param Submerchant $submerchant Initialization value for $this->submerchant + */ + public function __construct() + { + if (16 == func_num_args()) { + $this->items = func_get_arg(0); + $this->customer = func_get_arg(1); + $this->payments = func_get_arg(2); + $this->code = func_get_arg(3); + $this->customerId = func_get_arg(4); + $this->shipping = func_get_arg(5); + $this->metadata = func_get_arg(6); + $this->antifraudEnabled = func_get_arg(7); + $this->ip = func_get_arg(8); + $this->sessionId = func_get_arg(9); + $this->location = func_get_arg(10); + $this->device = func_get_arg(11); + $this->closed = func_get_arg(12); + $this->currency = func_get_arg(13); + $this->antifraud = func_get_arg(14); + $this->submerchant = func_get_arg(15); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['payments'] = $this->payments; + $json['code'] = $this->code; + $json['customer_id'] = $this->customerId; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['antifraud_enabled'] = $this->antifraudEnabled; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + $json['currency'] = $this->currency; + $json['antifraud'] = $this->antifraud; + $json['submerchant'] = $this->submerchant; + + return $json; + } +} diff --git a/src/Models/OrdersResponse.php b/src/Models/OrdersResponse.php new file mode 100644 index 0000000..51a710e --- /dev/null +++ b/src/Models/OrdersResponse.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/OrdersResponse1.php b/src/Models/OrdersResponse1.php new file mode 100644 index 0000000..c3719c2 --- /dev/null +++ b/src/Models/OrdersResponse1.php @@ -0,0 +1,217 @@ +id + * @param string $code Initialization value for $this->code + * @param string $currency Initialization value for $this->currency + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $charges Initialization value for $this->charges + * @param string $invoiceUrl Initialization value for $this->invoiceUrl + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param array $checkouts Initialization value for $this->checkouts + * @param string $ip Initialization value for $this->ip + * @param string $sessionId Initialization value for $this->sessionId + * @param Location $location Initialization value for $this->location + * @param Device $device Initialization value for $this->device + * @param bool $closed Initialization value for $this->closed + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->currency = func_get_arg(2); + $this->items = func_get_arg(3); + $this->customer = func_get_arg(4); + $this->status = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->updatedAt = func_get_arg(7); + $this->charges = func_get_arg(8); + $this->invoiceUrl = func_get_arg(9); + $this->shipping = func_get_arg(10); + $this->metadata = func_get_arg(11); + $this->checkouts = func_get_arg(12); + $this->ip = func_get_arg(13); + $this->sessionId = func_get_arg(14); + $this->location = func_get_arg(15); + $this->device = func_get_arg(16); + $this->closed = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['currency'] = $this->currency; + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['charges'] = $this->charges; + $json['invoice_url'] = $this->invoiceUrl; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['checkouts'] = $this->checkouts; + $json['ip'] = $this->ip; + $json['session_id'] = $this->sessionId; + $json['location'] = $this->location; + $json['device'] = $this->device; + $json['closed'] = $this->closed; + + return $json; + } +} diff --git a/src/Models/Paging.php b/src/Models/Paging.php new file mode 100644 index 0000000..6ff9d35 --- /dev/null +++ b/src/Models/Paging.php @@ -0,0 +1,66 @@ +total + * @param string $previous Initialization value for $this->previous + * @param string $next Initialization value for $this->next + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->total = func_get_arg(0); + $this->previous = func_get_arg(1); + $this->next = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['total'] = $this->total; + $json['previous'] = $this->previous; + $json['next'] = $this->next; + + return $json; + } +} diff --git a/src/Models/Payment.php b/src/Models/Payment.php new file mode 100644 index 0000000..6446a9d --- /dev/null +++ b/src/Models/Payment.php @@ -0,0 +1,198 @@ +paymentMethod + * @param CreditCard1 $creditCard Initialization value for $this->creditCard + * @param DebitCard1 $debitCard Initialization value for $this->debitCard + * @param Boleto1 $boleto Initialization value for $this->boleto + * @param string $currency Initialization value for $this->currency + * @param Voucher $voucher Initialization value for $this->voucher + * @param array $split Initialization value for $this->split + * @param BankTransfer1 $bankTransfer Initialization value for $this->bankTransfer + * @param string $gatewayAffiliationId Initialization value for $this->gatewayAffiliationId + * @param integer $amount Initialization value for $this->amount + * @param Checkout $checkout Initialization value for $this->checkout + * @param string $customerId Initialization value for $this->customerId + * @param Customer8 $customer Initialization value for $this->customer + * @param array $metadata Initialization value for $this->metadata + * @param CreateCashPaymentRequest $cash Initialization value for $this->cash + * @param PrivateLabel $privateLabel Initialization value for $this->privateLabel + * @param Pix $pix Initialization value for $this->pix + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->paymentMethod = func_get_arg(0); + $this->creditCard = func_get_arg(1); + $this->debitCard = func_get_arg(2); + $this->boleto = func_get_arg(3); + $this->currency = func_get_arg(4); + $this->voucher = func_get_arg(5); + $this->split = func_get_arg(6); + $this->bankTransfer = func_get_arg(7); + $this->gatewayAffiliationId = func_get_arg(8); + $this->amount = func_get_arg(9); + $this->checkout = func_get_arg(10); + $this->customerId = func_get_arg(11); + $this->customer = func_get_arg(12); + $this->metadata = func_get_arg(13); + $this->cash = func_get_arg(14); + $this->privateLabel = func_get_arg(15); + $this->pix = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['payment_method'] = $this->paymentMethod; + $json['credit_card'] = $this->creditCard; + $json['debit_card'] = $this->debitCard; + $json['boleto'] = $this->boleto; + $json['currency'] = $this->currency; + $json['voucher'] = $this->voucher; + $json['split'] = $this->split; + $json['bank_transfer'] = $this->bankTransfer; + $json['gateway_affiliation_id'] = $this->gatewayAffiliationId; + $json['amount'] = $this->amount; + $json['checkout'] = $this->checkout; + $json['customer_id'] = $this->customerId; + $json['customer'] = $this->customer; + $json['metadata'] = $this->metadata; + $json['cash'] = $this->cash; + $json['private_label'] = $this->privateLabel; + $json['pix'] = $this->pix; + + return $json; + } +} diff --git a/src/Models/Period.php b/src/Models/Period.php new file mode 100644 index 0000000..c752c8e --- /dev/null +++ b/src/Models/Period.php @@ -0,0 +1,145 @@ +startAt + * @param \DateTime $endAt Initialization value for $this->endAt + * @param string $id Initialization value for $this->id + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param string $status Initialization value for $this->status + * @param integer $duration Initialization value for $this->duration + * @param string $createdAt Initialization value for $this->createdAt + * @param string $updatedAt Initialization value for $this->updatedAt + * @param integer $cycle Initialization value for $this->cycle + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->startAt = func_get_arg(0); + $this->endAt = func_get_arg(1); + $this->id = func_get_arg(2); + $this->billingAt = func_get_arg(3); + $this->subscription = func_get_arg(4); + $this->status = func_get_arg(5); + $this->duration = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->cycle = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_at'] = DateTimeHelper::toRfc3339DateTime($this->startAt); + $json['end_at'] = DateTimeHelper::toRfc3339DateTime($this->endAt); + $json['id'] = $this->id; + $json['billing_at'] = DateTimeHelper::toRfc3339DateTime($this->billingAt); + $json['subscription'] = $this->subscription; + $json['status'] = $this->status; + $json['duration'] = $this->duration; + $json['created_at'] = $this->createdAt; + $json['updated_at'] = $this->updatedAt; + $json['cycle'] = $this->cycle; + + return $json; + } +} diff --git a/src/Models/Pix.php b/src/Models/Pix.php new file mode 100644 index 0000000..e708fe5 --- /dev/null +++ b/src/Models/Pix.php @@ -0,0 +1,69 @@ +expiresAt + * @param integer $expiresIn Initialization value for $this->expiresIn + * @param array $additionalInformation Initialization value for $this->additionalInformation + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->expiresAt = func_get_arg(0); + $this->expiresIn = func_get_arg(1); + $this->additionalInformation = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['expires_at'] = isset($this->expiresAt) ? + DateTimeHelper::toRfc3339DateTime($this->expiresAt) : null; + $json['expires_in'] = $this->expiresIn; + $json['additional_information'] = $this->additionalInformation; + + return $json; + } +} diff --git a/src/Models/Plan.php b/src/Models/Plan.php new file mode 100644 index 0000000..4207eda --- /dev/null +++ b/src/Models/Plan.php @@ -0,0 +1,258 @@ +id + * @param string $name Initialization value for $this->name + * @param string $description Initialization value for $this->description + * @param string $url Initialization value for $this->url + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param string $billingType Initialization value for $this->billingType + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param array $installments Initialization value for $this->installments + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $items Initialization value for $this->items + * @param array $billingDays Initialization value for $this->billingDays + * @param bool $shippable Initialization value for $this->shippable + * @param array $metadata Initialization value for $this->metadata + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->description = func_get_arg(2); + $this->url = func_get_arg(3); + $this->statementDescriptor = func_get_arg(4); + $this->interval = func_get_arg(5); + $this->intervalCount = func_get_arg(6); + $this->billingType = func_get_arg(7); + $this->paymentMethods = func_get_arg(8); + $this->installments = func_get_arg(9); + $this->status = func_get_arg(10); + $this->currency = func_get_arg(11); + $this->createdAt = func_get_arg(12); + $this->updatedAt = func_get_arg(13); + $this->items = func_get_arg(14); + $this->billingDays = func_get_arg(15); + $this->shippable = func_get_arg(16); + $this->metadata = func_get_arg(17); + $this->trialPeriodDays = func_get_arg(18); + $this->minimumPrice = func_get_arg(19); + $this->deletedAt = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['url'] = $this->url; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['billing_type'] = $this->billingType; + $json['payment_methods'] = $this->paymentMethods; + $json['installments'] = $this->installments; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['items'] = $this->items; + $json['billing_days'] = $this->billingDays; + $json['shippable'] = $this->shippable; + $json['metadata'] = $this->metadata; + $json['trial_period_days'] = $this->trialPeriodDays; + $json['minimum_price'] = $this->minimumPrice; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/PlansItemsRequest.php b/src/Models/PlansItemsRequest.php new file mode 100644 index 0000000..86cc837 --- /dev/null +++ b/src/Models/PlansItemsRequest.php @@ -0,0 +1,95 @@ +name + * @param string $description Initialization value for $this->description + * @param string $status Initialization value for $this->status + * @param PricingScheme3 $pricingScheme Initialization value for $this->pricingScheme + * @param integer $quantity Initialization value for $this->quantity + * @param integer $cycles Initialization value for $this->cycles + */ + public function __construct() + { + if (6 == func_num_args()) { + $this->name = func_get_arg(0); + $this->description = func_get_arg(1); + $this->status = func_get_arg(2); + $this->pricingScheme = func_get_arg(3); + $this->quantity = func_get_arg(4); + $this->cycles = func_get_arg(5); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['status'] = $this->status; + $json['pricing_scheme'] = $this->pricingScheme; + $json['quantity'] = $this->quantity; + $json['cycles'] = $this->cycles; + + return $json; + } +} diff --git a/src/Models/PlansItemsRequest1.php b/src/Models/PlansItemsRequest1.php new file mode 100644 index 0000000..4f5aa7c --- /dev/null +++ b/src/Models/PlansItemsRequest1.php @@ -0,0 +1,95 @@ +name + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param string $id Initialization value for $this->id + * @param string $description Initialization value for $this->description + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + */ + public function __construct() + { + if (6 == func_num_args()) { + $this->name = func_get_arg(0); + $this->pricingScheme = func_get_arg(1); + $this->id = func_get_arg(2); + $this->description = func_get_arg(3); + $this->cycles = func_get_arg(4); + $this->quantity = func_get_arg(5); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['pricing_scheme'] = $this->pricingScheme; + $json['id'] = $this->id; + $json['description'] = $this->description; + $json['cycles'] = $this->cycles; + $json['quantity'] = $this->quantity; + + return $json; + } +} diff --git a/src/Models/PlansItemsResponse.php b/src/Models/PlansItemsResponse.php new file mode 100644 index 0000000..22b9206 --- /dev/null +++ b/src/Models/PlansItemsResponse.php @@ -0,0 +1,152 @@ +id + * @param string $name Initialization value for $this->name + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param PricingScheme $pricingScheme Initialization value for $this->pricingScheme + * @param string $description Initialization value for $this->description + * @param Plan $plan Initialization value for $this->plan + * @param integer $quantity Initialization value for $this->quantity + * @param integer $cycles Initialization value for $this->cycles + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->status = func_get_arg(2); + $this->createdAt = func_get_arg(3); + $this->updatedAt = func_get_arg(4); + $this->pricingScheme = func_get_arg(5); + $this->description = func_get_arg(6); + $this->plan = func_get_arg(7); + $this->quantity = func_get_arg(8); + $this->cycles = func_get_arg(9); + $this->deletedAt = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['pricing_scheme'] = $this->pricingScheme; + $json['description'] = $this->description; + $json['plan'] = $this->plan; + $json['quantity'] = $this->quantity; + $json['cycles'] = $this->cycles; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/PlansMetadataRequest.php b/src/Models/PlansMetadataRequest.php new file mode 100644 index 0000000..32501ae --- /dev/null +++ b/src/Models/PlansMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/PlansMetadataResponse.php b/src/Models/PlansMetadataResponse.php new file mode 100644 index 0000000..fda97ff --- /dev/null +++ b/src/Models/PlansMetadataResponse.php @@ -0,0 +1,258 @@ +id + * @param string $name Initialization value for $this->name + * @param string $description Initialization value for $this->description + * @param string $url Initialization value for $this->url + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param string $billingType Initialization value for $this->billingType + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param array $installments Initialization value for $this->installments + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $items Initialization value for $this->items + * @param array $billingDays Initialization value for $this->billingDays + * @param bool $shippable Initialization value for $this->shippable + * @param array $metadata Initialization value for $this->metadata + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->description = func_get_arg(2); + $this->url = func_get_arg(3); + $this->statementDescriptor = func_get_arg(4); + $this->interval = func_get_arg(5); + $this->intervalCount = func_get_arg(6); + $this->billingType = func_get_arg(7); + $this->paymentMethods = func_get_arg(8); + $this->installments = func_get_arg(9); + $this->status = func_get_arg(10); + $this->currency = func_get_arg(11); + $this->createdAt = func_get_arg(12); + $this->updatedAt = func_get_arg(13); + $this->items = func_get_arg(14); + $this->billingDays = func_get_arg(15); + $this->shippable = func_get_arg(16); + $this->metadata = func_get_arg(17); + $this->trialPeriodDays = func_get_arg(18); + $this->minimumPrice = func_get_arg(19); + $this->deletedAt = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['url'] = $this->url; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['billing_type'] = $this->billingType; + $json['payment_methods'] = $this->paymentMethods; + $json['installments'] = $this->installments; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['items'] = $this->items; + $json['billing_days'] = $this->billingDays; + $json['shippable'] = $this->shippable; + $json['metadata'] = $this->metadata; + $json['trial_period_days'] = $this->trialPeriodDays; + $json['minimum_price'] = $this->minimumPrice; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/PlansRequest.php b/src/Models/PlansRequest.php new file mode 100644 index 0000000..7f4fd83 --- /dev/null +++ b/src/Models/PlansRequest.php @@ -0,0 +1,221 @@ +name + * @param string $description Initialization value for $this->description + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param array $items Initialization value for $this->items + * @param bool $shippable Initialization value for $this->shippable + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param array $installments Initialization value for $this->installments + * @param string $currency Initialization value for $this->currency + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param array $billingDays Initialization value for $this->billingDays + * @param string $billingType Initialization value for $this->billingType + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param array $metadata Initialization value for $this->metadata + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + */ + public function __construct() + { + if (18 == func_num_args()) { + $this->name = func_get_arg(0); + $this->description = func_get_arg(1); + $this->statementDescriptor = func_get_arg(2); + $this->items = func_get_arg(3); + $this->shippable = func_get_arg(4); + $this->paymentMethods = func_get_arg(5); + $this->installments = func_get_arg(6); + $this->currency = func_get_arg(7); + $this->interval = func_get_arg(8); + $this->intervalCount = func_get_arg(9); + $this->billingDays = func_get_arg(10); + $this->billingType = func_get_arg(11); + $this->pricingScheme = func_get_arg(12); + $this->metadata = func_get_arg(13); + $this->minimumPrice = func_get_arg(14); + $this->cycles = func_get_arg(15); + $this->quantity = func_get_arg(16); + $this->trialPeriodDays = func_get_arg(17); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['items'] = $this->items; + $json['shippable'] = $this->shippable; + $json['payment_methods'] = $this->paymentMethods; + $json['installments'] = $this->installments; + $json['currency'] = $this->currency; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['billing_days'] = $this->billingDays; + $json['billing_type'] = $this->billingType; + $json['pricing_scheme'] = $this->pricingScheme; + $json['metadata'] = $this->metadata; + $json['minimum_price'] = $this->minimumPrice; + $json['cycles'] = $this->cycles; + $json['quantity'] = $this->quantity; + $json['trial_period_days'] = $this->trialPeriodDays; + + return $json; + } +} diff --git a/src/Models/PlansRequest1.php b/src/Models/PlansRequest1.php new file mode 100644 index 0000000..a1c1ff1 --- /dev/null +++ b/src/Models/PlansRequest1.php @@ -0,0 +1,191 @@ +name + * @param string $description Initialization value for $this->description + * @param array $installments Initialization value for $this->installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $currency Initialization value for $this->currency + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param string $billingType Initialization value for $this->billingType + * @param string $status Initialization value for $this->status + * @param bool $shippable Initialization value for $this->shippable + * @param array $billingDays Initialization value for $this->billingDays + * @param array $metadata Initialization value for $this->metadata + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + */ + public function __construct() + { + if (15 == func_num_args()) { + $this->name = func_get_arg(0); + $this->description = func_get_arg(1); + $this->installments = func_get_arg(2); + $this->statementDescriptor = func_get_arg(3); + $this->currency = func_get_arg(4); + $this->interval = func_get_arg(5); + $this->intervalCount = func_get_arg(6); + $this->paymentMethods = func_get_arg(7); + $this->billingType = func_get_arg(8); + $this->status = func_get_arg(9); + $this->shippable = func_get_arg(10); + $this->billingDays = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->minimumPrice = func_get_arg(13); + $this->trialPeriodDays = func_get_arg(14); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['installments'] = $this->installments; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['currency'] = $this->currency; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['payment_methods'] = $this->paymentMethods; + $json['billing_type'] = $this->billingType; + $json['status'] = $this->status; + $json['shippable'] = $this->shippable; + $json['billing_days'] = $this->billingDays; + $json['metadata'] = $this->metadata; + $json['minimum_price'] = $this->minimumPrice; + $json['trial_period_days'] = $this->trialPeriodDays; + + return $json; + } +} diff --git a/src/Models/PlansResponse.php b/src/Models/PlansResponse.php new file mode 100644 index 0000000..b0be760 --- /dev/null +++ b/src/Models/PlansResponse.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/PlansResponse1.php b/src/Models/PlansResponse1.php new file mode 100644 index 0000000..888767b --- /dev/null +++ b/src/Models/PlansResponse1.php @@ -0,0 +1,258 @@ +id + * @param string $name Initialization value for $this->name + * @param string $description Initialization value for $this->description + * @param string $url Initialization value for $this->url + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param string $billingType Initialization value for $this->billingType + * @param array $paymentMethods Initialization value for $this->paymentMethods + * @param array $installments Initialization value for $this->installments + * @param string $status Initialization value for $this->status + * @param string $currency Initialization value for $this->currency + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param array $items Initialization value for $this->items + * @param array $billingDays Initialization value for $this->billingDays + * @param bool $shippable Initialization value for $this->shippable + * @param array $metadata Initialization value for $this->metadata + * @param integer $trialPeriodDays Initialization value for $this->trialPeriodDays + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + */ + public function __construct() + { + if (21 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->description = func_get_arg(2); + $this->url = func_get_arg(3); + $this->statementDescriptor = func_get_arg(4); + $this->interval = func_get_arg(5); + $this->intervalCount = func_get_arg(6); + $this->billingType = func_get_arg(7); + $this->paymentMethods = func_get_arg(8); + $this->installments = func_get_arg(9); + $this->status = func_get_arg(10); + $this->currency = func_get_arg(11); + $this->createdAt = func_get_arg(12); + $this->updatedAt = func_get_arg(13); + $this->items = func_get_arg(14); + $this->billingDays = func_get_arg(15); + $this->shippable = func_get_arg(16); + $this->metadata = func_get_arg(17); + $this->trialPeriodDays = func_get_arg(18); + $this->minimumPrice = func_get_arg(19); + $this->deletedAt = func_get_arg(20); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['description'] = $this->description; + $json['url'] = $this->url; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['billing_type'] = $this->billingType; + $json['payment_methods'] = $this->paymentMethods; + $json['installments'] = $this->installments; + $json['status'] = $this->status; + $json['currency'] = $this->currency; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['items'] = $this->items; + $json['billing_days'] = $this->billingDays; + $json['shippable'] = $this->shippable; + $json['metadata'] = $this->metadata; + $json['trial_period_days'] = $this->trialPeriodDays; + $json['minimum_price'] = $this->minimumPrice; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + + return $json; + } +} diff --git a/src/Models/PriceBracket.php b/src/Models/PriceBracket.php new file mode 100644 index 0000000..0955e1c --- /dev/null +++ b/src/Models/PriceBracket.php @@ -0,0 +1,77 @@ +startQuantity + * @param integer $price Initialization value for $this->price + * @param integer $endQuantity Initialization value for $this->endQuantity + * @param integer $overagePrice Initialization value for $this->overagePrice + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->startQuantity = func_get_arg(0); + $this->price = func_get_arg(1); + $this->endQuantity = func_get_arg(2); + $this->overagePrice = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_quantity'] = $this->startQuantity; + $json['price'] = $this->price; + $json['end_quantity'] = $this->endQuantity; + $json['overage_price'] = $this->overagePrice; + + return $json; + } +} diff --git a/src/Models/PricingScheme.php b/src/Models/PricingScheme.php new file mode 100644 index 0000000..9899868 --- /dev/null +++ b/src/Models/PricingScheme.php @@ -0,0 +1,87 @@ +price + * @param string $schemeType Initialization value for $this->schemeType + * @param array $priceBrackets Initialization value for $this->priceBrackets + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param double $percentage Initialization value for $this->percentage + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->price = func_get_arg(0); + $this->schemeType = func_get_arg(1); + $this->priceBrackets = func_get_arg(2); + $this->minimumPrice = func_get_arg(3); + $this->percentage = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['price'] = $this->price; + $json['scheme_type'] = $this->schemeType; + $json['price_brackets'] = $this->priceBrackets; + $json['minimum_price'] = $this->minimumPrice; + $json['percentage'] = $this->percentage; + + return $json; + } +} diff --git a/src/Models/PricingScheme3.php b/src/Models/PricingScheme3.php new file mode 100644 index 0000000..cf74ff2 --- /dev/null +++ b/src/Models/PricingScheme3.php @@ -0,0 +1,86 @@ +schemeType + * @param array $priceBrackets Initialization value for $this->priceBrackets + * @param integer $price Initialization value for $this->price + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param double $percentage Initialization value for $this->percentage + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->schemeType = func_get_arg(0); + $this->priceBrackets = func_get_arg(1); + $this->price = func_get_arg(2); + $this->minimumPrice = func_get_arg(3); + $this->percentage = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['scheme_type'] = $this->schemeType; + $json['price_brackets'] = $this->priceBrackets; + $json['price'] = $this->price; + $json['minimum_price'] = $this->minimumPrice; + $json['percentage'] = $this->percentage; + + return $json; + } +} diff --git a/src/Models/PricingScheme4.php b/src/Models/PricingScheme4.php new file mode 100644 index 0000000..84fc510 --- /dev/null +++ b/src/Models/PricingScheme4.php @@ -0,0 +1,86 @@ +schemeType + * @param array $priceBrackets Initialization value for $this->priceBrackets + * @param integer $price Initialization value for $this->price + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param double $percentage Initialization value for $this->percentage + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->schemeType = func_get_arg(0); + $this->priceBrackets = func_get_arg(1); + $this->price = func_get_arg(2); + $this->minimumPrice = func_get_arg(3); + $this->percentage = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['scheme_type'] = $this->schemeType; + $json['price_brackets'] = $this->priceBrackets; + $json['price'] = $this->price; + $json['minimum_price'] = $this->minimumPrice; + $json['percentage'] = $this->percentage; + + return $json; + } +} diff --git a/src/Models/PrivateLabel.php b/src/Models/PrivateLabel.php new file mode 100644 index 0000000..bf0f4ec --- /dev/null +++ b/src/Models/PrivateLabel.php @@ -0,0 +1,139 @@ +installments + * @param string $statementDescriptor Initialization value for $this->statementDescriptor + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param bool $recurrence Initialization value for $this->recurrence + * @param bool $capture Initialization value for $this->capture + * @param bool $extendedLimitEnabled Initialization value for $this->extendedLimitEnabled + * @param string $extendedLimitCode Initialization value for $this->extendedLimitCode + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + */ + public function __construct() + { + switch (func_num_args()) { + case 10: + $this->installments = func_get_arg(0); + $this->statementDescriptor = func_get_arg(1); + $this->card = func_get_arg(2); + $this->cardId = func_get_arg(3); + $this->cardToken = func_get_arg(4); + $this->recurrence = func_get_arg(5); + $this->capture = func_get_arg(6); + $this->extendedLimitEnabled = func_get_arg(7); + $this->extendedLimitCode = func_get_arg(8); + $this->recurrencyCycle = func_get_arg(9); + break; + + default: + $this->installments = 1; + $this->capture = true; + break; + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['installments'] = $this->installments; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['card'] = $this->card; + $json['card_id'] = $this->cardId; + $json['card_token'] = $this->cardToken; + $json['recurrence'] = $this->recurrence; + $json['capture'] = $this->capture; + $json['extended_limit_enabled'] = $this->extendedLimitEnabled; + $json['extended_limit_code'] = $this->extendedLimitCode; + $json['recurrency_cycle'] = $this->recurrencyCycle; + + return $json; + } +} diff --git a/src/Models/Recipient.php b/src/Models/Recipient.php new file mode 100644 index 0000000..71b6c01 --- /dev/null +++ b/src/Models/Recipient.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsAnticipationLimitsResponse.php b/src/Models/RecipientsAnticipationLimitsResponse.php new file mode 100644 index 0000000..f766c52 --- /dev/null +++ b/src/Models/RecipientsAnticipationLimitsResponse.php @@ -0,0 +1,57 @@ +amount + * @param integer $anticipationFee Initialization value for $this->anticipationFee + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->anticipationFee = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['anticipation_fee'] = $this->anticipationFee; + + return $json; + } +} diff --git a/src/Models/RecipientsAnticipationsRequest.php b/src/Models/RecipientsAnticipationsRequest.php new file mode 100644 index 0000000..91408d8 --- /dev/null +++ b/src/Models/RecipientsAnticipationsRequest.php @@ -0,0 +1,69 @@ +amount + * @param string $timeframe Initialization value for $this->timeframe + * @param \DateTime $paymentDate Initialization value for $this->paymentDate + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->timeframe = func_get_arg(1); + $this->paymentDate = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['timeframe'] = $this->timeframe; + $json['payment_date'] = DateTimeHelper::toRfc3339DateTime($this->paymentDate); + + return $json; + } +} diff --git a/src/Models/RecipientsAnticipationsResponse.php b/src/Models/RecipientsAnticipationsResponse.php new file mode 100644 index 0000000..a3999e8 --- /dev/null +++ b/src/Models/RecipientsAnticipationsResponse.php @@ -0,0 +1,144 @@ +id + * @param integer $requestedAmount Initialization value for $this->requestedAmount + * @param integer $approvedAmount Initialization value for $this->approvedAmount + * @param Recipient $recipient Initialization value for $this->recipient + * @param string $pgid Initialization value for $this->pgid + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param \DateTime $paymentDate Initialization value for $this->paymentDate + * @param string $status Initialization value for $this->status + * @param string $timeframe Initialization value for $this->timeframe + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->id = func_get_arg(0); + $this->requestedAmount = func_get_arg(1); + $this->approvedAmount = func_get_arg(2); + $this->recipient = func_get_arg(3); + $this->pgid = func_get_arg(4); + $this->createdAt = func_get_arg(5); + $this->updatedAt = func_get_arg(6); + $this->paymentDate = func_get_arg(7); + $this->status = func_get_arg(8); + $this->timeframe = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['requested_amount'] = $this->requestedAmount; + $json['approved_amount'] = $this->approvedAmount; + $json['recipient'] = $this->recipient; + $json['pgid'] = $this->pgid; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['payment_date'] = DateTimeHelper::toRfc3339DateTime($this->paymentDate); + $json['status'] = $this->status; + $json['timeframe'] = $this->timeframe; + + return $json; + } +} diff --git a/src/Models/RecipientsAnticipationsResponse1.php b/src/Models/RecipientsAnticipationsResponse1.php new file mode 100644 index 0000000..499e423 --- /dev/null +++ b/src/Models/RecipientsAnticipationsResponse1.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/RecipientsAutomaticAnticipationSettingsResponse.php b/src/Models/RecipientsAutomaticAnticipationSettingsResponse.php new file mode 100644 index 0000000..2bb38bf --- /dev/null +++ b/src/Models/RecipientsAutomaticAnticipationSettingsResponse.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsBalanceResponse.php b/src/Models/RecipientsBalanceResponse.php new file mode 100644 index 0000000..04e5d90 --- /dev/null +++ b/src/Models/RecipientsBalanceResponse.php @@ -0,0 +1,88 @@ +currency + * @param integer $availableAmount Initialization value for $this->availableAmount + * @param Recipient $recipient Initialization value for $this->recipient + * @param integer $waitingFundsAmount Initialization value for $this->waitingFundsAmount + * @param integer $transferredAmount Initialization value for $this->transferredAmount + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->currency = func_get_arg(0); + $this->availableAmount = func_get_arg(1); + $this->recipient = func_get_arg(2); + $this->waitingFundsAmount = func_get_arg(3); + $this->transferredAmount = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['currency'] = $this->currency; + $json['available_amount'] = $this->availableAmount; + $json['recipient'] = $this->recipient; + $json['waiting_funds_amount'] = $this->waitingFundsAmount; + $json['transferred_amount'] = $this->transferredAmount; + + return $json; + } +} diff --git a/src/Models/RecipientsCodeResponse.php b/src/Models/RecipientsCodeResponse.php new file mode 100644 index 0000000..85f9705 --- /dev/null +++ b/src/Models/RecipientsCodeResponse.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsDefaultBankAccountRequest.php b/src/Models/RecipientsDefaultBankAccountRequest.php new file mode 100644 index 0000000..8992be8 --- /dev/null +++ b/src/Models/RecipientsDefaultBankAccountRequest.php @@ -0,0 +1,58 @@ +bankAccount + * @param string $paymentMode Initialization value for $this->paymentMode + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->bankAccount = func_get_arg(0); + $this->paymentMode = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['bank_account'] = $this->bankAccount; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsDefaultBankAccountResponse.php b/src/Models/RecipientsDefaultBankAccountResponse.php new file mode 100644 index 0000000..e1338b3 --- /dev/null +++ b/src/Models/RecipientsDefaultBankAccountResponse.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsMetadataRequest.php b/src/Models/RecipientsMetadataRequest.php new file mode 100644 index 0000000..133cd41 --- /dev/null +++ b/src/Models/RecipientsMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/RecipientsMetadataResponse.php b/src/Models/RecipientsMetadataResponse.php new file mode 100644 index 0000000..31e632c --- /dev/null +++ b/src/Models/RecipientsMetadataResponse.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsRequest.php b/src/Models/RecipientsRequest.php new file mode 100644 index 0000000..1370998 --- /dev/null +++ b/src/Models/RecipientsRequest.php @@ -0,0 +1,138 @@ +name + * @param string $email Initialization value for $this->email + * @param string $description Initialization value for $this->description + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param DefaultBankAccount1 $defaultBankAccount Initialization value for $this->defaultBankAccount + * @param array $metadata Initialization value for $this->metadata + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this->transferSettings + * @param string $code Initialization value for $this->code + * @param string $paymentMode Initialization value for $this->paymentMode + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->description = func_get_arg(2); + $this->document = func_get_arg(3); + $this->type = func_get_arg(4); + $this->defaultBankAccount = func_get_arg(5); + $this->metadata = func_get_arg(6); + $this->transferSettings = func_get_arg(7); + $this->code = func_get_arg(8); + $this->paymentMode = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['description'] = $this->description; + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['default_bank_account'] = $this->defaultBankAccount; + $json['metadata'] = $this->metadata; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsRequest1.php b/src/Models/RecipientsRequest1.php new file mode 100644 index 0000000..7dd11ae --- /dev/null +++ b/src/Models/RecipientsRequest1.php @@ -0,0 +1,96 @@ +name + * @param string $email Initialization value for $this->email + * @param string $description Initialization value for $this->description + * @param string $type Initialization value for $this->type + * @param string $status Initialization value for $this->status + * @param array $metadata Initialization value for $this->metadata + */ + public function __construct() + { + if (6 == func_num_args()) { + $this->name = func_get_arg(0); + $this->email = func_get_arg(1); + $this->description = func_get_arg(2); + $this->type = func_get_arg(3); + $this->status = func_get_arg(4); + $this->metadata = func_get_arg(5); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/RecipientsResponse.php b/src/Models/RecipientsResponse.php new file mode 100644 index 0000000..9d92f3b --- /dev/null +++ b/src/Models/RecipientsResponse.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/RecipientsResponse1.php b/src/Models/RecipientsResponse1.php new file mode 100644 index 0000000..73c43ee --- /dev/null +++ b/src/Models/RecipientsResponse1.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsTransferSettingsResponse.php b/src/Models/RecipientsTransferSettingsResponse.php new file mode 100644 index 0000000..e62892f --- /dev/null +++ b/src/Models/RecipientsTransferSettingsResponse.php @@ -0,0 +1,233 @@ +id + * @param string $name Initialization value for $this- + * >name + * @param string $email Initialization value for $this- + * >email + * @param string $document Initialization value for $this- + * >document + * @param string $description Initialization value for $this- + * >description + * @param string $type Initialization value for $this- + * >type + * @param string $status Initialization value for $this- + * >status + * @param \DateTime $createdAt Initialization value for $this- + * >createdAt + * @param \DateTime $updatedAt Initialization value for $this- + * >updatedAt + * @param \DateTime $deletedAt Initialization value for $this- + * >deletedAt + * @param DefaultBankAccount $defaultBankAccount Initialization value for $this- + * >defaultBankAccount + * @param array $gatewayRecipients Initialization value for $this- + * >gatewayRecipients + * @param array $metadata Initialization value for $this- + * >metadata + * @param CreateAutomaticAnticipationSettingsRequest $automaticAnticipationSettings Initialization value for $this- + * >automaticAnticipationSettings + * @param GetTransferSettingsResponse $transferSettings Initialization value for $this- + * >transferSettings + * @param string $code Initialization value for $this- + * >code + * @param string $paymentMode Initialization value for $this- + * >paymentMode + */ + public function __construct() + { + if (17 == func_num_args()) { + $this->id = func_get_arg(0); + $this->name = func_get_arg(1); + $this->email = func_get_arg(2); + $this->document = func_get_arg(3); + $this->description = func_get_arg(4); + $this->type = func_get_arg(5); + $this->status = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->deletedAt = func_get_arg(9); + $this->defaultBankAccount = func_get_arg(10); + $this->gatewayRecipients = func_get_arg(11); + $this->metadata = func_get_arg(12); + $this->automaticAnticipationSettings = func_get_arg(13); + $this->transferSettings = func_get_arg(14); + $this->code = func_get_arg(15); + $this->paymentMode = func_get_arg(16); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['description'] = $this->description; + $json['type'] = $this->type; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['deleted_at'] = DateTimeHelper::toRfc3339DateTime($this->deletedAt); + $json['default_bank_account'] = $this->defaultBankAccount; + $json['gateway_recipients'] = $this->gatewayRecipients; + $json['metadata'] = $this->metadata; + $json['automatic_anticipation_settings'] = $this->automaticAnticipationSettings; + $json['transfer_settings'] = $this->transferSettings; + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + + return $json; + } +} diff --git a/src/Models/RecipientsTransfersRequest.php b/src/Models/RecipientsTransfersRequest.php new file mode 100644 index 0000000..79800c1 --- /dev/null +++ b/src/Models/RecipientsTransfersRequest.php @@ -0,0 +1,56 @@ +amount + * @param array $metadata Initialization value for $this->metadata + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->metadata = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/RecipientsTransfersResponse.php b/src/Models/RecipientsTransfersResponse.php new file mode 100644 index 0000000..0ff0052 --- /dev/null +++ b/src/Models/RecipientsTransfersResponse.php @@ -0,0 +1,112 @@ +id + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param \DateTime $updatedAt Initialization value for $this->updatedAt + * @param BankAccount $bankAccount Initialization value for $this->bankAccount + * @param array $metadata Initialization value for $this->metadata + */ + public function __construct() + { + if (7 == func_num_args()) { + $this->id = func_get_arg(0); + $this->amount = func_get_arg(1); + $this->status = func_get_arg(2); + $this->createdAt = func_get_arg(3); + $this->updatedAt = func_get_arg(4); + $this->bankAccount = func_get_arg(5); + $this->metadata = func_get_arg(6); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + $json['bank_account'] = $this->bankAccount; + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/RecipientsTransfersResponse1.php b/src/Models/RecipientsTransfersResponse1.php new file mode 100644 index 0000000..6dc9ae0 --- /dev/null +++ b/src/Models/RecipientsTransfersResponse1.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/Setup.php b/src/Models/Setup.php new file mode 100644 index 0000000..eddc018 --- /dev/null +++ b/src/Models/Setup.php @@ -0,0 +1,76 @@ +id + * @param string $description Initialization value for $this->description + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->id = func_get_arg(0); + $this->description = func_get_arg(1); + $this->amount = func_get_arg(2); + $this->status = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['description'] = $this->description; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + + return $json; + } +} diff --git a/src/Models/Setup1.php b/src/Models/Setup1.php new file mode 100644 index 0000000..219c0c2 --- /dev/null +++ b/src/Models/Setup1.php @@ -0,0 +1,66 @@ +amount + * @param string $description Initialization value for $this->description + * @param Payment $payment Initialization value for $this->payment + */ + public function __construct() + { + if (3 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->description = func_get_arg(1); + $this->payment = func_get_arg(2); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['payment'] = $this->payment; + + return $json; + } +} diff --git a/src/Models/Shipping.php b/src/Models/Shipping.php new file mode 100644 index 0000000..e0722d3 --- /dev/null +++ b/src/Models/Shipping.php @@ -0,0 +1,123 @@ +amount + * @param string $description Initialization value for $this->description + * @param string $recipientName Initialization value for $this->recipientName + * @param string $recipientPhone Initialization value for $this->recipientPhone + * @param Address $address Initialization value for $this->address + * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate + * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate + * @param string $type Initialization value for $this->type + */ + public function __construct() + { + if (8 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->description = func_get_arg(1); + $this->recipientName = func_get_arg(2); + $this->recipientPhone = func_get_arg(3); + $this->address = func_get_arg(4); + $this->maxDeliveryDate = func_get_arg(5); + $this->estimatedDeliveryDate = func_get_arg(6); + $this->type = func_get_arg(7); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['recipient_name'] = $this->recipientName; + $json['recipient_phone'] = $this->recipientPhone; + $json['address'] = $this->address; + $json['max_delivery_date'] = isset($this->maxDeliveryDate) ? + DateTimeHelper::toRfc3339DateTime($this->maxDeliveryDate) : null; + $json['estimated_delivery_date'] = isset($this->estimatedDeliveryDate) ? + DateTimeHelper::toRfc3339DateTime($this->estimatedDeliveryDate) : null; + $json['type'] = $this->type; + + return $json; + } +} diff --git a/src/Models/Shipping3.php b/src/Models/Shipping3.php new file mode 100644 index 0000000..71efd85 --- /dev/null +++ b/src/Models/Shipping3.php @@ -0,0 +1,134 @@ +amount + * @param string $description Initialization value for $this->description + * @param string $recipientName Initialization value for $this->recipientName + * @param string $recipientPhone Initialization value for $this->recipientPhone + * @param string $addressId Initialization value for $this->addressId + * @param Address1 $address Initialization value for $this->address + * @param \DateTime $maxDeliveryDate Initialization value for $this->maxDeliveryDate + * @param \DateTime $estimatedDeliveryDate Initialization value for $this->estimatedDeliveryDate + * @param string $type Initialization value for $this->type + */ + public function __construct() + { + if (9 == func_num_args()) { + $this->amount = func_get_arg(0); + $this->description = func_get_arg(1); + $this->recipientName = func_get_arg(2); + $this->recipientPhone = func_get_arg(3); + $this->addressId = func_get_arg(4); + $this->address = func_get_arg(5); + $this->maxDeliveryDate = func_get_arg(6); + $this->estimatedDeliveryDate = func_get_arg(7); + $this->type = func_get_arg(8); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['amount'] = $this->amount; + $json['description'] = $this->description; + $json['recipient_name'] = $this->recipientName; + $json['recipient_phone'] = $this->recipientPhone; + $json['address_id'] = $this->addressId; + $json['address'] = $this->address; + $json['max_delivery_date'] = isset($this->maxDeliveryDate) ? + DateTimeHelper::toRfc3339DateTime($this->maxDeliveryDate) : null; + $json['estimated_delivery_date'] = isset($this->estimatedDeliveryDate) ? + DateTimeHelper::toRfc3339DateTime($this->estimatedDeliveryDate) : null; + $json['type'] = $this->type; + + return $json; + } +} diff --git a/src/Models/Split.php b/src/Models/Split.php new file mode 100644 index 0000000..c70c73f --- /dev/null +++ b/src/Models/Split.php @@ -0,0 +1,56 @@ +enabled + * @param array $rules Initialization value for $this->rules + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->enabled = func_get_arg(0); + $this->rules = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['enabled'] = $this->enabled; + $json['rules'] = $this->rules; + + return $json; + } +} diff --git a/src/Models/Submerchant.php b/src/Models/Submerchant.php new file mode 100644 index 0000000..0041a6a --- /dev/null +++ b/src/Models/Submerchant.php @@ -0,0 +1,118 @@ +paymentFacilitatorCode + * @param string $code Initialization value for $this->code + * @param string $name Initialization value for $this->name + * @param string $merchantCategoryCode Initialization value for $this->merchantCategoryCode + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param GetPhoneResponse $phone Initialization value for $this->phone + * @param Address1 $address Initialization value for $this->address + */ + public function __construct() + { + if (8 == func_num_args()) { + $this->paymentFacilitatorCode = func_get_arg(0); + $this->code = func_get_arg(1); + $this->name = func_get_arg(2); + $this->merchantCategoryCode = func_get_arg(3); + $this->document = func_get_arg(4); + $this->type = func_get_arg(5); + $this->phone = func_get_arg(6); + $this->address = func_get_arg(7); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['payment_facilitator_code'] = $this->paymentFacilitatorCode; + $json['code'] = $this->code; + $json['name'] = $this->name; + $json['merchant_category_code'] = $this->merchantCategoryCode; + $json['document'] = $this->document; + $json['type'] = $this->type; + $json['phone'] = $this->phone; + $json['address'] = $this->address; + + return $json; + } +} diff --git a/src/Models/SubscriptionsBillingDateRequest.php b/src/Models/SubscriptionsBillingDateRequest.php new file mode 100644 index 0000000..50f50e5 --- /dev/null +++ b/src/Models/SubscriptionsBillingDateRequest.php @@ -0,0 +1,49 @@ +nextBillingAt + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->nextBillingAt = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['next_billing_at'] = DateTimeHelper::toRfc3339DateTime($this->nextBillingAt); + + return $json; + } +} diff --git a/src/Models/SubscriptionsCardRequest.php b/src/Models/SubscriptionsCardRequest.php new file mode 100644 index 0000000..c94e1e3 --- /dev/null +++ b/src/Models/SubscriptionsCardRequest.php @@ -0,0 +1,57 @@ +card + * @param string $cardId Initialization value for $this->cardId + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->card = func_get_arg(0); + $this->cardId = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['card'] = $this->card; + $json['card_id'] = $this->cardId; + + return $json; + } +} diff --git a/src/Models/SubscriptionsCyclesPayRequest.php b/src/Models/SubscriptionsCyclesPayRequest.php new file mode 100644 index 0000000..34f0808 --- /dev/null +++ b/src/Models/SubscriptionsCyclesPayRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/SubscriptionsCyclesPayResponse.php b/src/Models/SubscriptionsCyclesPayResponse.php new file mode 100644 index 0000000..4e394a6 --- /dev/null +++ b/src/Models/SubscriptionsCyclesPayResponse.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/SubscriptionsCyclesResponse.php b/src/Models/SubscriptionsCyclesResponse.php new file mode 100644 index 0000000..242a3d7 --- /dev/null +++ b/src/Models/SubscriptionsCyclesResponse.php @@ -0,0 +1,145 @@ +startAt + * @param \DateTime $endAt Initialization value for $this->endAt + * @param string $id Initialization value for $this->id + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param string $status Initialization value for $this->status + * @param integer $duration Initialization value for $this->duration + * @param string $createdAt Initialization value for $this->createdAt + * @param string $updatedAt Initialization value for $this->updatedAt + * @param integer $cycle Initialization value for $this->cycle + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->startAt = func_get_arg(0); + $this->endAt = func_get_arg(1); + $this->id = func_get_arg(2); + $this->billingAt = func_get_arg(3); + $this->subscription = func_get_arg(4); + $this->status = func_get_arg(5); + $this->duration = func_get_arg(6); + $this->createdAt = func_get_arg(7); + $this->updatedAt = func_get_arg(8); + $this->cycle = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_at'] = DateTimeHelper::toRfc3339DateTime($this->startAt); + $json['end_at'] = DateTimeHelper::toRfc3339DateTime($this->endAt); + $json['id'] = $this->id; + $json['billing_at'] = DateTimeHelper::toRfc3339DateTime($this->billingAt); + $json['subscription'] = $this->subscription; + $json['status'] = $this->status; + $json['duration'] = $this->duration; + $json['created_at'] = $this->createdAt; + $json['updated_at'] = $this->updatedAt; + $json['cycle'] = $this->cycle; + + return $json; + } +} diff --git a/src/Models/SubscriptionsCyclesResponse2.php b/src/Models/SubscriptionsCyclesResponse2.php new file mode 100644 index 0000000..c48690a --- /dev/null +++ b/src/Models/SubscriptionsCyclesResponse2.php @@ -0,0 +1,54 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/SubscriptionsDiscountsRequest.php b/src/Models/SubscriptionsDiscountsRequest.php new file mode 100644 index 0000000..b2bd7d2 --- /dev/null +++ b/src/Models/SubscriptionsDiscountsRequest.php @@ -0,0 +1,86 @@ +value + * @param string $discountType Initialization value for $this->discountType + * @param string $itemId Initialization value for $this->itemId + * @param integer $cycles Initialization value for $this->cycles + * @param string $description Initialization value for $this->description + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->value = func_get_arg(0); + $this->discountType = func_get_arg(1); + $this->itemId = func_get_arg(2); + $this->cycles = func_get_arg(3); + $this->description = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['value'] = $this->value; + $json['discount_type'] = $this->discountType; + $json['item_id'] = $this->itemId; + $json['cycles'] = $this->cycles; + $json['description'] = $this->description; + + return $json; + } +} diff --git a/src/Models/SubscriptionsDiscountsResponse.php b/src/Models/SubscriptionsDiscountsResponse.php new file mode 100644 index 0000000..6c3f90a --- /dev/null +++ b/src/Models/SubscriptionsDiscountsResponse.php @@ -0,0 +1,139 @@ +id + * @param double $value Initialization value for $this->value + * @param string $discountType Initialization value for $this->discountType + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param integer $cycles Initialization value for $this->cycles + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $description Initialization value for $this->description + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param GetSubscriptionItemResponse $subscriptionItem Initialization value for $this->subscriptionItem + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->id = func_get_arg(0); + $this->value = func_get_arg(1); + $this->discountType = func_get_arg(2); + $this->status = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->cycles = func_get_arg(5); + $this->deletedAt = func_get_arg(6); + $this->description = func_get_arg(7); + $this->subscription = func_get_arg(8); + $this->subscriptionItem = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['value'] = $this->value; + $json['discount_type'] = $this->discountType; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['cycles'] = $this->cycles; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['description'] = $this->description; + $json['subscription'] = $this->subscription; + $json['subscription_item'] = $this->subscriptionItem; + + return $json; + } +} diff --git a/src/Models/SubscriptionsGatewayAffiliationIdRequest.php b/src/Models/SubscriptionsGatewayAffiliationIdRequest.php new file mode 100644 index 0000000..4c05e38 --- /dev/null +++ b/src/Models/SubscriptionsGatewayAffiliationIdRequest.php @@ -0,0 +1,47 @@ +gatewayAffiliationId + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->gatewayAffiliationId = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['gateway_affiliation_id'] = $this->gatewayAffiliationId; + + return $json; + } +} diff --git a/src/Models/SubscriptionsIncrementsRequest.php b/src/Models/SubscriptionsIncrementsRequest.php new file mode 100644 index 0000000..ab0ea87 --- /dev/null +++ b/src/Models/SubscriptionsIncrementsRequest.php @@ -0,0 +1,86 @@ +value + * @param string $incrementType Initialization value for $this->incrementType + * @param string $itemId Initialization value for $this->itemId + * @param integer $cycles Initialization value for $this->cycles + * @param string $description Initialization value for $this->description + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->value = func_get_arg(0); + $this->incrementType = func_get_arg(1); + $this->itemId = func_get_arg(2); + $this->cycles = func_get_arg(3); + $this->description = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['value'] = $this->value; + $json['increment_type'] = $this->incrementType; + $json['item_id'] = $this->itemId; + $json['cycles'] = $this->cycles; + $json['description'] = $this->description; + + return $json; + } +} diff --git a/src/Models/SubscriptionsIncrementsResponse.php b/src/Models/SubscriptionsIncrementsResponse.php new file mode 100644 index 0000000..db5f355 --- /dev/null +++ b/src/Models/SubscriptionsIncrementsResponse.php @@ -0,0 +1,139 @@ +id + * @param double $value Initialization value for $this->value + * @param string $incrementType Initialization value for $this->incrementType + * @param string $status Initialization value for $this->status + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param integer $cycles Initialization value for $this->cycles + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param string $description Initialization value for $this->description + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param GetSubscriptionItemResponse $subscriptionItem Initialization value for $this->subscriptionItem + */ + public function __construct() + { + if (10 == func_num_args()) { + $this->id = func_get_arg(0); + $this->value = func_get_arg(1); + $this->incrementType = func_get_arg(2); + $this->status = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->cycles = func_get_arg(5); + $this->deletedAt = func_get_arg(6); + $this->description = func_get_arg(7); + $this->subscription = func_get_arg(8); + $this->subscriptionItem = func_get_arg(9); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['value'] = $this->value; + $json['increment_type'] = $this->incrementType; + $json['status'] = $this->status; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['cycles'] = $this->cycles; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['description'] = $this->description; + $json['subscription'] = $this->subscription; + $json['subscription_item'] = $this->subscriptionItem; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsRequest.php b/src/Models/SubscriptionsItemsRequest.php new file mode 100644 index 0000000..a029ebe --- /dev/null +++ b/src/Models/SubscriptionsItemsRequest.php @@ -0,0 +1,105 @@ +description + * @param string $status Initialization value for $this->status + * @param PricingScheme3 $pricingScheme Initialization value for $this->pricingScheme + * @param string $name Initialization value for $this->name + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $minimumPrice Initialization value for $this->minimumPrice + */ + public function __construct() + { + if (7 == func_num_args()) { + $this->description = func_get_arg(0); + $this->status = func_get_arg(1); + $this->pricingScheme = func_get_arg(2); + $this->name = func_get_arg(3); + $this->cycles = func_get_arg(4); + $this->quantity = func_get_arg(5); + $this->minimumPrice = func_get_arg(6); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['description'] = $this->description; + $json['status'] = $this->status; + $json['pricing_scheme'] = $this->pricingScheme; + $json['name'] = $this->name; + $json['cycles'] = $this->cycles; + $json['quantity'] = $this->quantity; + $json['minimum_price'] = $this->minimumPrice; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsRequest1.php b/src/Models/SubscriptionsItemsRequest1.php new file mode 100644 index 0000000..cacafc7 --- /dev/null +++ b/src/Models/SubscriptionsItemsRequest1.php @@ -0,0 +1,126 @@ +description + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param string $id Initialization value for $this->id + * @param string $planItemId Initialization value for $this->planItemId + * @param array $discounts Initialization value for $this->discounts + * @param string $name Initialization value for $this->name + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $minimumPrice Initialization value for $this->minimumPrice + */ + public function __construct() + { + if (9 == func_num_args()) { + $this->description = func_get_arg(0); + $this->pricingScheme = func_get_arg(1); + $this->id = func_get_arg(2); + $this->planItemId = func_get_arg(3); + $this->discounts = func_get_arg(4); + $this->name = func_get_arg(5); + $this->cycles = func_get_arg(6); + $this->quantity = func_get_arg(7); + $this->minimumPrice = func_get_arg(8); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['description'] = $this->description; + $json['pricing_scheme'] = $this->pricingScheme; + $json['id'] = $this->id; + $json['plan_item_id'] = $this->planItemId; + $json['discounts'] = $this->discounts; + $json['name'] = $this->name; + $json['cycles'] = $this->cycles; + $json['quantity'] = $this->quantity; + $json['minimum_price'] = $this->minimumPrice; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsResponse3.php b/src/Models/SubscriptionsItemsResponse3.php new file mode 100644 index 0000000..f7f1d1d --- /dev/null +++ b/src/Models/SubscriptionsItemsResponse3.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsUsagesResponse.php b/src/Models/SubscriptionsItemsUsagesResponse.php new file mode 100644 index 0000000..3f5aca9 --- /dev/null +++ b/src/Models/SubscriptionsItemsUsagesResponse.php @@ -0,0 +1,151 @@ +id + * @param integer $quantity Initialization value for $this->quantity + * @param string $description Initialization value for $this->description + * @param \DateTime $usedAt Initialization value for $this->usedAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param string $status Initialization value for $this->status + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param GetSubscriptionItemResponse $subscriptionItem Initialization value for $this->subscriptionItem + * @param string $code Initialization value for $this->code + * @param string $group Initialization value for $this->group + * @param integer $amount Initialization value for $this->amount + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->id = func_get_arg(0); + $this->quantity = func_get_arg(1); + $this->description = func_get_arg(2); + $this->usedAt = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->status = func_get_arg(5); + $this->deletedAt = func_get_arg(6); + $this->subscriptionItem = func_get_arg(7); + $this->code = func_get_arg(8); + $this->group = func_get_arg(9); + $this->amount = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['quantity'] = $this->quantity; + $json['description'] = $this->description; + $json['used_at'] = DateTimeHelper::toRfc3339DateTime($this->usedAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['status'] = $this->status; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['subscription_item'] = $this->subscriptionItem; + $json['code'] = $this->code; + $json['group'] = $this->group; + $json['amount'] = $this->amount; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsUsagesResponse1.php b/src/Models/SubscriptionsItemsUsagesResponse1.php new file mode 100644 index 0000000..a857e62 --- /dev/null +++ b/src/Models/SubscriptionsItemsUsagesResponse1.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/SubscriptionsItemsUsagesUsageIdResponse.php b/src/Models/SubscriptionsItemsUsagesUsageIdResponse.php new file mode 100644 index 0000000..ac863ba --- /dev/null +++ b/src/Models/SubscriptionsItemsUsagesUsageIdResponse.php @@ -0,0 +1,151 @@ +id + * @param integer $quantity Initialization value for $this->quantity + * @param string $description Initialization value for $this->description + * @param \DateTime $usedAt Initialization value for $this->usedAt + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param string $status Initialization value for $this->status + * @param \DateTime $deletedAt Initialization value for $this->deletedAt + * @param GetSubscriptionItemResponse $subscriptionItem Initialization value for $this->subscriptionItem + * @param string $code Initialization value for $this->code + * @param string $group Initialization value for $this->group + * @param integer $amount Initialization value for $this->amount + */ + public function __construct() + { + if (11 == func_num_args()) { + $this->id = func_get_arg(0); + $this->quantity = func_get_arg(1); + $this->description = func_get_arg(2); + $this->usedAt = func_get_arg(3); + $this->createdAt = func_get_arg(4); + $this->status = func_get_arg(5); + $this->deletedAt = func_get_arg(6); + $this->subscriptionItem = func_get_arg(7); + $this->code = func_get_arg(8); + $this->group = func_get_arg(9); + $this->amount = func_get_arg(10); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['quantity'] = $this->quantity; + $json['description'] = $this->description; + $json['used_at'] = DateTimeHelper::toRfc3339DateTime($this->usedAt); + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['status'] = $this->status; + $json['deleted_at'] = isset($this->deletedAt) ? + DateTimeHelper::toRfc3339DateTime($this->deletedAt) : null; + $json['subscription_item'] = $this->subscriptionItem; + $json['code'] = $this->code; + $json['group'] = $this->group; + $json['amount'] = $this->amount; + + return $json; + } +} diff --git a/src/Models/SubscriptionsMetadataRequest.php b/src/Models/SubscriptionsMetadataRequest.php new file mode 100644 index 0000000..897af4b --- /dev/null +++ b/src/Models/SubscriptionsMetadataRequest.php @@ -0,0 +1,46 @@ +metadata + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->metadata = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['metadata'] = $this->metadata; + + return $json; + } +} diff --git a/src/Models/SubscriptionsMinimumPriceRequest.php b/src/Models/SubscriptionsMinimumPriceRequest.php new file mode 100644 index 0000000..aa54aec --- /dev/null +++ b/src/Models/SubscriptionsMinimumPriceRequest.php @@ -0,0 +1,46 @@ +minimumPrice + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->minimumPrice = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['minimum_price'] = $this->minimumPrice; + + return $json; + } +} diff --git a/src/Models/SubscriptionsPartialInvoiceResponse.php b/src/Models/SubscriptionsPartialInvoiceResponse.php new file mode 100644 index 0000000..7e3dfa2 --- /dev/null +++ b/src/Models/SubscriptionsPartialInvoiceResponse.php @@ -0,0 +1,278 @@ +id + * @param string $code Initialization value for $this->code + * @param string $url Initialization value for $this->url + * @param integer $amount Initialization value for $this->amount + * @param string $status Initialization value for $this->status + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param array $items Initialization value for $this->items + * @param Customer $customer Initialization value for $this->customer + * @param Charge $charge Initialization value for $this->charge + * @param integer $installments Initialization value for $this->installments + * @param BillingAddress $billingAddress Initialization value for $this->billingAddress + * @param GetSubscriptionResponse $subscription Initialization value for $this->subscription + * @param Cycle $cycle Initialization value for $this->cycle + * @param Shipping $shipping Initialization value for $this->shipping + * @param array $metadata Initialization value for $this->metadata + * @param \DateTime $dueAt Initialization value for $this->dueAt + * @param \DateTime $canceledAt Initialization value for $this->canceledAt + * @param \DateTime $billingAt Initialization value for $this->billingAt + * @param \DateTime $seenAt Initialization value for $this->seenAt + * @param integer $totalDiscount Initialization value for $this->totalDiscount + * @param integer $totalIncrement Initialization value for $this->totalIncrement + * @param string $subscriptionId Initialization value for $this->subscriptionId + */ + public function __construct() + { + if (23 == func_num_args()) { + $this->id = func_get_arg(0); + $this->code = func_get_arg(1); + $this->url = func_get_arg(2); + $this->amount = func_get_arg(3); + $this->status = func_get_arg(4); + $this->paymentMethod = func_get_arg(5); + $this->createdAt = func_get_arg(6); + $this->items = func_get_arg(7); + $this->customer = func_get_arg(8); + $this->charge = func_get_arg(9); + $this->installments = func_get_arg(10); + $this->billingAddress = func_get_arg(11); + $this->subscription = func_get_arg(12); + $this->cycle = func_get_arg(13); + $this->shipping = func_get_arg(14); + $this->metadata = func_get_arg(15); + $this->dueAt = func_get_arg(16); + $this->canceledAt = func_get_arg(17); + $this->billingAt = func_get_arg(18); + $this->seenAt = func_get_arg(19); + $this->totalDiscount = func_get_arg(20); + $this->totalIncrement = func_get_arg(21); + $this->subscriptionId = func_get_arg(22); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['code'] = $this->code; + $json['url'] = $this->url; + $json['amount'] = $this->amount; + $json['status'] = $this->status; + $json['payment_method'] = $this->paymentMethod; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['items'] = $this->items; + $json['customer'] = $this->customer; + $json['charge'] = $this->charge; + $json['installments'] = $this->installments; + $json['billing_address'] = $this->billingAddress; + $json['subscription'] = $this->subscription; + $json['cycle'] = $this->cycle; + $json['shipping'] = $this->shipping; + $json['metadata'] = $this->metadata; + $json['due_at'] = isset($this->dueAt) ? + DateTimeHelper::toRfc3339DateTime($this->dueAt) : null; + $json['canceled_at'] = isset($this->canceledAt) ? + DateTimeHelper::toRfc3339DateTime($this->canceledAt) : null; + $json['billing_at'] = isset($this->billingAt) ? + DateTimeHelper::toRfc3339DateTime($this->billingAt) : null; + $json['seen_at'] = isset($this->seenAt) ? + DateTimeHelper::toRfc3339DateTime($this->seenAt) : null; + $json['total_discount'] = $this->totalDiscount; + $json['total_increment'] = $this->totalIncrement; + $json['subscription_id'] = $this->subscriptionId; + + return $json; + } +} diff --git a/src/Models/SubscriptionsPaymentMethodRequest.php b/src/Models/SubscriptionsPaymentMethodRequest.php new file mode 100644 index 0000000..3382f1c --- /dev/null +++ b/src/Models/SubscriptionsPaymentMethodRequest.php @@ -0,0 +1,78 @@ +paymentMethod + * @param string $cardId Initialization value for $this->cardId + * @param Card1 $card Initialization value for $this->card + * @param string $cardToken Initialization value for $this->cardToken + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->paymentMethod = func_get_arg(0); + $this->cardId = func_get_arg(1); + $this->card = func_get_arg(2); + $this->cardToken = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['payment_method'] = $this->paymentMethod; + $json['card_id'] = $this->cardId; + $json['card'] = $this->card; + $json['card_token'] = $this->cardToken; + + return $json; + } +} diff --git a/src/Models/SubscriptionsPeriodsLatestEndAtRequest.php b/src/Models/SubscriptionsPeriodsLatestEndAtRequest.php new file mode 100644 index 0000000..1da739f --- /dev/null +++ b/src/Models/SubscriptionsPeriodsLatestEndAtRequest.php @@ -0,0 +1,49 @@ +endAt + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->endAt = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['end_at'] = isset($this->endAt) ? + DateTimeHelper::toRfc3339DateTime($this->endAt) : null; + + return $json; + } +} diff --git a/src/Models/SubscriptionsRequest.php b/src/Models/SubscriptionsRequest.php new file mode 100644 index 0000000..c6badb4 --- /dev/null +++ b/src/Models/SubscriptionsRequest.php @@ -0,0 +1,47 @@ +cancelPendingInvoices + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->cancelPendingInvoices = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['cancel_pending_invoices'] = $this->cancelPendingInvoices; + + return $json; + } +} diff --git a/src/Models/SubscriptionsRequest1.php b/src/Models/SubscriptionsRequest1.php new file mode 100644 index 0000000..67eaffe --- /dev/null +++ b/src/Models/SubscriptionsRequest1.php @@ -0,0 +1,360 @@ +customer + * @param Card1 $card Initialization value for $this->card + * @param string $code Initialization value for $this->code + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param string $billingType Initialization value for $this->billingType + * @param string $statementDescriptor Initialization value for $this- + * >statementDescriptor + * @param string $description Initialization value for $this->description + * @param string $currency Initialization value for $this->currency + * @param string $interval Initialization value for $this->interval + * @param integer $intervalCount Initialization value for $this->intervalCount + * @param PricingScheme4 $pricingScheme Initialization value for $this->pricingScheme + * @param array $items Initialization value for $this->items + * @param Shipping3 $shipping Initialization value for $this->shipping + * @param array $discounts Initialization value for $this->discounts + * @param array $metadata Initialization value for $this->metadata + * @param Setup1 $setup Initialization value for $this->setup + * @param string $planId Initialization value for $this->planId + * @param string $customerId Initialization value for $this->customerId + * @param string $cardId Initialization value for $this->cardId + * @param integer $billingDay Initialization value for $this->billingDay + * @param integer $installments Initialization value for $this->installments + * @param \DateTime $startAt Initialization value for $this->startAt + * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param integer $cycles Initialization value for $this->cycles + * @param string $cardToken Initialization value for $this->cardToken + * @param string $gatewayAffiliationId Initialization value for $this- + * >gatewayAffiliationId + * @param integer $quantity Initialization value for $this->quantity + * @param integer $boletoDueDays Initialization value for $this->boletoDueDays + * @param array $increments Initialization value for $this->increments + * @param CreatePeriodRequest $period Initialization value for $this->period + * @param Submerchant $submerchant Initialization value for $this->submerchant + * @param UpdateSubscriptionSplitRequest $split Initialization value for $this->split + */ + public function __construct() + { + if (32 == func_num_args()) { + $this->customer = func_get_arg(0); + $this->card = func_get_arg(1); + $this->code = func_get_arg(2); + $this->paymentMethod = func_get_arg(3); + $this->billingType = func_get_arg(4); + $this->statementDescriptor = func_get_arg(5); + $this->description = func_get_arg(6); + $this->currency = func_get_arg(7); + $this->interval = func_get_arg(8); + $this->intervalCount = func_get_arg(9); + $this->pricingScheme = func_get_arg(10); + $this->items = func_get_arg(11); + $this->shipping = func_get_arg(12); + $this->discounts = func_get_arg(13); + $this->metadata = func_get_arg(14); + $this->setup = func_get_arg(15); + $this->planId = func_get_arg(16); + $this->customerId = func_get_arg(17); + $this->cardId = func_get_arg(18); + $this->billingDay = func_get_arg(19); + $this->installments = func_get_arg(20); + $this->startAt = func_get_arg(21); + $this->minimumPrice = func_get_arg(22); + $this->cycles = func_get_arg(23); + $this->cardToken = func_get_arg(24); + $this->gatewayAffiliationId = func_get_arg(25); + $this->quantity = func_get_arg(26); + $this->boletoDueDays = func_get_arg(27); + $this->increments = func_get_arg(28); + $this->period = func_get_arg(29); + $this->submerchant = func_get_arg(30); + $this->split = func_get_arg(31); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['customer'] = $this->customer; + $json['card'] = $this->card; + $json['code'] = $this->code; + $json['payment_method'] = $this->paymentMethod; + $json['billing_type'] = $this->billingType; + $json['statement_descriptor'] = $this->statementDescriptor; + $json['description'] = $this->description; + $json['currency'] = $this->currency; + $json['interval'] = $this->interval; + $json['interval_count'] = $this->intervalCount; + $json['pricing_scheme'] = $this->pricingScheme; + $json['items'] = $this->items; + $json['shipping'] = $this->shipping; + $json['discounts'] = $this->discounts; + $json['metadata'] = $this->metadata; + $json['setup'] = $this->setup; + $json['plan_id'] = $this->planId; + $json['customer_id'] = $this->customerId; + $json['card_id'] = $this->cardId; + $json['billing_day'] = $this->billingDay; + $json['installments'] = $this->installments; + $json['start_at'] = isset($this->startAt) ? + DateTimeHelper::toRfc3339DateTime($this->startAt) : null; + $json['minimum_price'] = $this->minimumPrice; + $json['cycles'] = $this->cycles; + $json['card_token'] = $this->cardToken; + $json['gateway_affiliation_id'] = $this->gatewayAffiliationId; + $json['quantity'] = $this->quantity; + $json['boleto_due_days'] = $this->boletoDueDays; + $json['increments'] = $this->increments; + $json['period'] = $this->period; + $json['submerchant'] = $this->submerchant; + $json['split'] = $this->split; + + return $json; + } +} diff --git a/src/Models/SubscriptionsResponse3.php b/src/Models/SubscriptionsResponse3.php new file mode 100644 index 0000000..ddcb2ce --- /dev/null +++ b/src/Models/SubscriptionsResponse3.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/SubscriptionsStartAtRequest.php b/src/Models/SubscriptionsStartAtRequest.php new file mode 100644 index 0000000..9927ed3 --- /dev/null +++ b/src/Models/SubscriptionsStartAtRequest.php @@ -0,0 +1,49 @@ +startAt + */ + public function __construct() + { + if (1 == func_num_args()) { + $this->startAt = func_get_arg(0); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['start_at'] = DateTimeHelper::toRfc3339DateTime($this->startAt); + + return $json; + } +} diff --git a/src/Models/ThreedSecure.php b/src/Models/ThreedSecure.php new file mode 100644 index 0000000..67a93b2 --- /dev/null +++ b/src/Models/ThreedSecure.php @@ -0,0 +1,88 @@ +mpi + * @param string $eci Initialization value for $this->eci + * @param string $cavv Initialization value for $this->cavv + * @param string $transactionId Initialization value for $this->transactionId + * @param string $successUrl Initialization value for $this->successUrl + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->mpi = func_get_arg(0); + $this->eci = func_get_arg(1); + $this->cavv = func_get_arg(2); + $this->transactionId = func_get_arg(3); + $this->successUrl = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['mpi'] = $this->mpi; + $json['eci'] = $this->eci; + $json['cavv'] = $this->cavv; + $json['transaction_Id'] = $this->transactionId; + $json['success_url'] = $this->successUrl; + + return $json; + } +} diff --git a/src/Models/ThreedSecure1.php b/src/Models/ThreedSecure1.php new file mode 100644 index 0000000..26c02af --- /dev/null +++ b/src/Models/ThreedSecure1.php @@ -0,0 +1,103 @@ +mpi + * @param string $cavv Initialization value for $this->cavv + * @param string $eci Initialization value for $this->eci + * @param string $transactionId Initialization value for $this->transactionId + * @param string $successUrl Initialization value for $this->successUrl + * @param string $dsTransactionId Initialization value for $this->dsTransactionId + * @param string $version Initialization value for $this->version + */ + public function __construct() + { + if (7 == func_num_args()) { + $this->mpi = func_get_arg(0); + $this->cavv = func_get_arg(1); + $this->eci = func_get_arg(2); + $this->transactionId = func_get_arg(3); + $this->successUrl = func_get_arg(4); + $this->dsTransactionId = func_get_arg(5); + $this->version = func_get_arg(6); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['mpi'] = $this->mpi; + $json['cavv'] = $this->cavv; + $json['eci'] = $this->eci; + $json['transaction_id'] = $this->transactionId; + $json['success_url'] = $this->successUrl; + $json['ds_transaction_id'] = $this->dsTransactionId; + $json['version'] = $this->version; + + return $json; + } +} diff --git a/src/Models/Token.php b/src/Models/Token.php new file mode 100644 index 0000000..ed1fe0c --- /dev/null +++ b/src/Models/Token.php @@ -0,0 +1,75 @@ +type + * @param ApplePay $applePay Initialization value for $this->applePay + * @param GooglePay $googlePay Initialization value for $this->googlePay + * @param CreateEmvDecryptRequest $emv Initialization value for $this->emv + */ + public function __construct() + { + if (4 == func_num_args()) { + $this->type = func_get_arg(0); + $this->applePay = func_get_arg(1); + $this->googlePay = func_get_arg(2); + $this->emv = func_get_arg(3); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['apple_pay'] = $this->applePay; + $json['google_pay'] = $this->googlePay; + $json['emv'] = $this->emv; + + return $json; + } +} diff --git a/src/Models/TokensRequest.php b/src/Models/TokensRequest.php new file mode 100644 index 0000000..34ad88e --- /dev/null +++ b/src/Models/TokensRequest.php @@ -0,0 +1,56 @@ +type + * @param Card11 $card Initialization value for $this->card + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->type = func_get_arg(0); + $this->card = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['card'] = $this->card; + + return $json; + } +} diff --git a/src/Models/TokensResponse.php b/src/Models/TokensResponse.php new file mode 100644 index 0000000..4b638c9 --- /dev/null +++ b/src/Models/TokensResponse.php @@ -0,0 +1,90 @@ +id + * @param string $type Initialization value for $this->type + * @param \DateTime $createdAt Initialization value for $this->createdAt + * @param string $expiresAt Initialization value for $this->expiresAt + * @param Card9 $card Initialization value for $this->card + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->id = func_get_arg(0); + $this->type = func_get_arg(1); + $this->createdAt = func_get_arg(2); + $this->expiresAt = func_get_arg(3); + $this->card = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['id'] = $this->id; + $json['type'] = $this->type; + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + $json['expires_at'] = $this->expiresAt; + $json['card'] = $this->card; + + return $json; + } +} diff --git a/src/Models/UpdateCardRequest.php b/src/Models/UpdateCardRequest.php index f674bac..14805f5 100644 --- a/src/Models/UpdateCardRequest.php +++ b/src/Models/UpdateCardRequest.php @@ -47,10 +47,10 @@ class UpdateCardRequest implements JsonSerializable public $billingAddressId; /** - * Billing address + * @todo Write general description for this property * @required * @maps billing_address - * @var \MundiAPILib\Models\CreateAddressRequest $billingAddress public property + * @var \MundiAPILib\Models\BillingAddress1 $billingAddress public property */ public $billingAddress; @@ -70,13 +70,13 @@ class UpdateCardRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $holderName Initialization value for $this->holderName - * @param integer $expMonth Initialization value for $this->expMonth - * @param integer $expYear Initialization value for $this->expYear - * @param string $billingAddressId Initialization value for $this->billingAddressId - * @param CreateAddressRequest $billingAddress Initialization value for $this->billingAddress - * @param array $metadata Initialization value for $this->metadata - * @param string $label Initialization value for $this->label + * @param string $holderName Initialization value for $this->holderName + * @param integer $expMonth Initialization value for $this->expMonth + * @param integer $expYear Initialization value for $this->expYear + * @param string $billingAddressId Initialization value for $this->billingAddressId + * @param BillingAddress1 $billingAddress Initialization value for $this->billingAddress + * @param array $metadata Initialization value for $this->metadata + * @param string $label Initialization value for $this->label */ public function __construct() { diff --git a/src/Models/UpdateChargeCardRequest.php b/src/Models/UpdateChargeCardRequest.php index f4ead28..11095d6 100644 --- a/src/Models/UpdateChargeCardRequest.php +++ b/src/Models/UpdateChargeCardRequest.php @@ -31,9 +31,9 @@ class UpdateChargeCardRequest implements JsonSerializable public $cardId; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardRequest $card public property + * @var \MundiAPILib\Models\Card1 $card public property */ public $card; @@ -46,10 +46,10 @@ class UpdateChargeCardRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param bool $updateSubscription Initialization value for $this->updateSubscription - * @param string $cardId Initialization value for $this->cardId - * @param CreateCardRequest $card Initialization value for $this->card - * @param bool $recurrence Initialization value for $this->recurrence + * @param bool $updateSubscription Initialization value for $this->updateSubscription + * @param string $cardId Initialization value for $this->cardId + * @param Card1 $card Initialization value for $this->card + * @param bool $recurrence Initialization value for $this->recurrence */ public function __construct() { diff --git a/src/Models/UpdateChargePaymentMethodRequest.php b/src/Models/UpdateChargePaymentMethodRequest.php index 9aaeef9..663c93d 100644 --- a/src/Models/UpdateChargePaymentMethodRequest.php +++ b/src/Models/UpdateChargePaymentMethodRequest.php @@ -31,47 +31,47 @@ class UpdateChargePaymentMethodRequest implements JsonSerializable public $paymentMethod; /** - * Credit card data + * @todo Write general description for this property * @required * @maps credit_card - * @var \MundiAPILib\Models\CreateCreditCardPaymentRequest $creditCard public property + * @var \MundiAPILib\Models\CreditCard1 $creditCard public property */ public $creditCard; /** - * Debit card data + * @todo Write general description for this property * @required * @maps debit_card - * @var \MundiAPILib\Models\CreateDebitCardPaymentRequest $debitCard public property + * @var \MundiAPILib\Models\DebitCard1 $debitCard public property */ public $debitCard; /** - * Boleto data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateBoletoPaymentRequest $boleto public property + * @var \MundiAPILib\Models\Boleto1 $boleto public property */ public $boleto; /** - * Voucher data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateVoucherPaymentRequest $voucher public property + * @var \MundiAPILib\Models\Voucher $voucher public property */ public $voucher; /** - * Cash data + * @todo Write general description for this property * @required * @var \MundiAPILib\Models\CreateCashPaymentRequest $cash public property */ public $cash; /** - * Bank Transfer data + * @todo Write general description for this property * @required * @maps bank_transfer - * @var \MundiAPILib\Models\CreateBankTransferPaymentRequest $bankTransfer public property + * @var \MundiAPILib\Models\BankTransfer1 $bankTransfer public property */ public $bankTransfer; @@ -79,21 +79,21 @@ class UpdateChargePaymentMethodRequest implements JsonSerializable * @todo Write general description for this property * @required * @maps private_label - * @var \MundiAPILib\Models\CreatePrivateLabelPaymentRequest $privateLabel public property + * @var \MundiAPILib\Models\PrivateLabel $privateLabel public property */ public $privateLabel; /** * Constructor to set initial or default values of member properties - * @param bool $updateSubscription Initialization value for $this->updateSubscription - * @param string $paymentMethod Initialization value for $this->paymentMethod - * @param CreateCreditCardPaymentRequest $creditCard Initialization value for $this->creditCard - * @param CreateDebitCardPaymentRequest $debitCard Initialization value for $this->debitCard - * @param CreateBoletoPaymentRequest $boleto Initialization value for $this->boleto - * @param CreateVoucherPaymentRequest $voucher Initialization value for $this->voucher - * @param CreateCashPaymentRequest $cash Initialization value for $this->cash - * @param CreateBankTransferPaymentRequest $bankTransfer Initialization value for $this->bankTransfer - * @param CreatePrivateLabelPaymentRequest $privateLabel Initialization value for $this->privateLabel + * @param bool $updateSubscription Initialization value for $this->updateSubscription + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param CreditCard1 $creditCard Initialization value for $this->creditCard + * @param DebitCard1 $debitCard Initialization value for $this->debitCard + * @param Boleto1 $boleto Initialization value for $this->boleto + * @param Voucher $voucher Initialization value for $this->voucher + * @param CreateCashPaymentRequest $cash Initialization value for $this->cash + * @param BankTransfer1 $bankTransfer Initialization value for $this->bankTransfer + * @param PrivateLabel $privateLabel Initialization value for $this->privateLabel */ public function __construct() { diff --git a/src/Models/UpdateCustomerRequest.php b/src/Models/UpdateCustomerRequest.php index e7ec809..14fa864 100644 --- a/src/Models/UpdateCustomerRequest.php +++ b/src/Models/UpdateCustomerRequest.php @@ -39,8 +39,8 @@ class UpdateCustomerRequest implements JsonSerializable public $type; /** - * Address - * @var \MundiAPILib\Models\CreateAddressRequest|null $address public property + * @todo Write general description for this property + * @var \MundiAPILib\Models\Address1|null $address public property */ public $address; @@ -77,16 +77,16 @@ class UpdateCustomerRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $email Initialization value for $this->email - * @param string $document Initialization value for $this->document - * @param string $type Initialization value for $this->type - * @param CreateAddressRequest $address Initialization value for $this->address - * @param array $metadata Initialization value for $this->metadata - * @param CreatePhonesRequest $phones Initialization value for $this->phones - * @param string $code Initialization value for $this->code - * @param string $gender Initialization value for $this->gender - * @param string $documentType Initialization value for $this->documentType + * @param string $name Initialization value for $this->name + * @param string $email Initialization value for $this->email + * @param string $document Initialization value for $this->document + * @param string $type Initialization value for $this->type + * @param Address1 $address Initialization value for $this->address + * @param array $metadata Initialization value for $this->metadata + * @param CreatePhonesRequest $phones Initialization value for $this->phones + * @param string $code Initialization value for $this->code + * @param string $gender Initialization value for $this->gender + * @param string $documentType Initialization value for $this->documentType */ public function __construct() { diff --git a/src/Models/UpdatePlanItemRequest.php b/src/Models/UpdatePlanItemRequest.php index f49c382..cbe9fca 100644 --- a/src/Models/UpdatePlanItemRequest.php +++ b/src/Models/UpdatePlanItemRequest.php @@ -36,10 +36,10 @@ class UpdatePlanItemRequest implements JsonSerializable public $status; /** - * Pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\UpdatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme3 $pricingScheme public property */ public $pricingScheme; @@ -57,12 +57,12 @@ class UpdatePlanItemRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $name Initialization value for $this->name - * @param string $description Initialization value for $this->description - * @param string $status Initialization value for $this->status - * @param UpdatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme - * @param integer $quantity Initialization value for $this->quantity - * @param integer $cycles Initialization value for $this->cycles + * @param string $name Initialization value for $this->name + * @param string $description Initialization value for $this->description + * @param string $status Initialization value for $this->status + * @param PricingScheme3 $pricingScheme Initialization value for $this->pricingScheme + * @param integer $quantity Initialization value for $this->quantity + * @param integer $cycles Initialization value for $this->cycles */ public function __construct() { diff --git a/src/Models/UpdateRecipientBankAccountRequest.php b/src/Models/UpdateRecipientBankAccountRequest.php index 36c2cfe..535f318 100644 --- a/src/Models/UpdateRecipientBankAccountRequest.php +++ b/src/Models/UpdateRecipientBankAccountRequest.php @@ -15,10 +15,10 @@ class UpdateRecipientBankAccountRequest implements JsonSerializable { /** - * Bank account + * @todo Write general description for this property * @required * @maps bank_account - * @var \MundiAPILib\Models\CreateBankAccountRequest $bankAccount public property + * @var \MundiAPILib\Models\BankAccount1 $bankAccount public property */ public $bankAccount; @@ -32,20 +32,14 @@ class UpdateRecipientBankAccountRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param CreateBankAccountRequest $bankAccount Initialization value for $this->bankAccount - * @param string $paymentMode Initialization value for $this->paymentMode + * @param BankAccount1 $bankAccount Initialization value for $this->bankAccount + * @param string $paymentMode Initialization value for $this->paymentMode */ public function __construct() { - switch (func_num_args()) { - case 2: - $this->bankAccount = func_get_arg(0); - $this->paymentMode = func_get_arg(1); - break; - - default: - $this->paymentMode = 'bank_transfer'; - break; + if (2 == func_num_args()) { + $this->bankAccount = func_get_arg(0); + $this->paymentMode = func_get_arg(1); } } diff --git a/src/Models/UpdateSubscriptionCardRequest.php b/src/Models/UpdateSubscriptionCardRequest.php index 857c9dc..438dbda 100644 --- a/src/Models/UpdateSubscriptionCardRequest.php +++ b/src/Models/UpdateSubscriptionCardRequest.php @@ -15,9 +15,9 @@ class UpdateSubscriptionCardRequest implements JsonSerializable { /** - * Credit card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardRequest $card public property + * @var \MundiAPILib\Models\Card1 $card public property */ public $card; @@ -31,8 +31,8 @@ class UpdateSubscriptionCardRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $cardId Initialization value for $this->cardId + * @param Card1 $card Initialization value for $this->card + * @param string $cardId Initialization value for $this->cardId */ public function __construct() { diff --git a/src/Models/UpdateSubscriptionItemRequest.php b/src/Models/UpdateSubscriptionItemRequest.php index 08b5726..1a02f7e 100644 --- a/src/Models/UpdateSubscriptionItemRequest.php +++ b/src/Models/UpdateSubscriptionItemRequest.php @@ -29,10 +29,10 @@ class UpdateSubscriptionItemRequest implements JsonSerializable public $status; /** - * Pricing scheme + * @todo Write general description for this property * @required * @maps pricing_scheme - * @var \MundiAPILib\Models\UpdatePricingSchemeRequest $pricingScheme public property + * @var \MundiAPILib\Models\PricingScheme3 $pricingScheme public property */ public $pricingScheme; @@ -64,13 +64,13 @@ class UpdateSubscriptionItemRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $description Initialization value for $this->description - * @param string $status Initialization value for $this->status - * @param UpdatePricingSchemeRequest $pricingScheme Initialization value for $this->pricingScheme - * @param string $name Initialization value for $this->name - * @param integer $cycles Initialization value for $this->cycles - * @param integer $quantity Initialization value for $this->quantity - * @param integer $minimumPrice Initialization value for $this->minimumPrice + * @param string $description Initialization value for $this->description + * @param string $status Initialization value for $this->status + * @param PricingScheme3 $pricingScheme Initialization value for $this->pricingScheme + * @param string $name Initialization value for $this->name + * @param integer $cycles Initialization value for $this->cycles + * @param integer $quantity Initialization value for $this->quantity + * @param integer $minimumPrice Initialization value for $this->minimumPrice */ public function __construct() { diff --git a/src/Models/UpdateSubscriptionPaymentMethodRequest.php b/src/Models/UpdateSubscriptionPaymentMethodRequest.php index 60661b3..717532c 100644 --- a/src/Models/UpdateSubscriptionPaymentMethodRequest.php +++ b/src/Models/UpdateSubscriptionPaymentMethodRequest.php @@ -31,9 +31,9 @@ class UpdateSubscriptionPaymentMethodRequest implements JsonSerializable public $cardId; /** - * Card data + * @todo Write general description for this property * @required - * @var \MundiAPILib\Models\CreateCardRequest $card public property + * @var \MundiAPILib\Models\Card1 $card public property */ public $card; @@ -46,10 +46,10 @@ class UpdateSubscriptionPaymentMethodRequest implements JsonSerializable /** * Constructor to set initial or default values of member properties - * @param string $paymentMethod Initialization value for $this->paymentMethod - * @param string $cardId Initialization value for $this->cardId - * @param CreateCardRequest $card Initialization value for $this->card - * @param string $cardToken Initialization value for $this->cardToken + * @param string $paymentMethod Initialization value for $this->paymentMethod + * @param string $cardId Initialization value for $this->cardId + * @param Card1 $card Initialization value for $this->card + * @param string $cardToken Initialization value for $this->cardToken */ public function __construct() { diff --git a/src/Models/Usages.php b/src/Models/Usages.php new file mode 100644 index 0000000..25bea39 --- /dev/null +++ b/src/Models/Usages.php @@ -0,0 +1,56 @@ +data + * @param Paging $paging Initialization value for $this->paging + */ + public function __construct() + { + if (2 == func_num_args()) { + $this->data = func_get_arg(0); + $this->paging = func_get_arg(1); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['data'] = $this->data; + $json['paging'] = $this->paging; + + return $json; + } +} diff --git a/src/Models/Voucher.php b/src/Models/Voucher.php new file mode 100644 index 0000000..fae46f7 --- /dev/null +++ b/src/Models/Voucher.php @@ -0,0 +1,86 @@ +statementDescriptor + * @param string $cardId Initialization value for $this->cardId + * @param string $cardToken Initialization value for $this->cardToken + * @param Card1 $card Initialization value for $this->card + * @param string $recurrencyCycle Initialization value for $this->recurrencyCycle + */ + public function __construct() + { + if (5 == func_num_args()) { + $this->statementDescriptor = func_get_arg(0); + $this->cardId = func_get_arg(1); + $this->cardToken = func_get_arg(2); + $this->card = func_get_arg(3); + $this->recurrencyCycle = func_get_arg(4); + } + } + + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['statement_descriptor'] = $this->statementDescriptor; + $json['card_id'] = $this->cardId; + $json['card_token'] = $this->cardToken; + $json['Card'] = $this->card; + $json['recurrency_cycle'] = $this->recurrencyCycle; + + return $json; + } +} diff --git a/src/MundiAPIClient.php b/src/MundiAPIClient.php index 5d16da2..23fa3de 100644 --- a/src/MundiAPIClient.php +++ b/src/MundiAPIClient.php @@ -25,36 +25,28 @@ public function __construct( Configuration::$basicAuthPassword = $basicAuthPassword ? $basicAuthPassword : Configuration::$basicAuthPassword; } /** - * Singleton access to Customers controller - * @return Controllers\CustomersController The *Singleton* instance - */ - public function getCustomers() - { - return Controllers\CustomersController::getInstance(); - } - /** - * Singleton access to Charges controller - * @return Controllers\ChargesController The *Singleton* instance + * Singleton access to Subscriptions controller + * @return Controllers\SubscriptionsController The *Singleton* instance */ - public function getCharges() + public function getSubscriptions() { - return Controllers\ChargesController::getInstance(); + return Controllers\SubscriptionsController::getInstance(); } /** - * Singleton access to Recipients controller - * @return Controllers\RecipientsController The *Singleton* instance + * Singleton access to Orders controller + * @return Controllers\OrdersController The *Singleton* instance */ - public function getRecipients() + public function getOrders() { - return Controllers\RecipientsController::getInstance(); + return Controllers\OrdersController::getInstance(); } /** - * Singleton access to Subscriptions controller - * @return Controllers\SubscriptionsController The *Singleton* instance + * Singleton access to Plans controller + * @return Controllers\PlansController The *Singleton* instance */ - public function getSubscriptions() + public function getPlans() { - return Controllers\SubscriptionsController::getInstance(); + return Controllers\PlansController::getInstance(); } /** * Singleton access to Invoices controller @@ -65,28 +57,36 @@ public function getInvoices() return Controllers\InvoicesController::getInstance(); } /** - * Singleton access to Orders controller - * @return Controllers\OrdersController The *Singleton* instance + * Singleton access to Customers controller + * @return Controllers\CustomersController The *Singleton* instance */ - public function getOrders() + public function getCustomers() { - return Controllers\OrdersController::getInstance(); + return Controllers\CustomersController::getInstance(); } /** - * Singleton access to Tokens controller - * @return Controllers\TokensController The *Singleton* instance + * Singleton access to Charges controller + * @return Controllers\ChargesController The *Singleton* instance */ - public function getTokens() + public function getCharges() { - return Controllers\TokensController::getInstance(); + return Controllers\ChargesController::getInstance(); } /** - * Singleton access to Plans controller - * @return Controllers\PlansController The *Singleton* instance + * Singleton access to Recipients controller + * @return Controllers\RecipientsController The *Singleton* instance */ - public function getPlans() + public function getRecipients() { - return Controllers\PlansController::getInstance(); + return Controllers\RecipientsController::getInstance(); + } + /** + * Singleton access to Tokens controller + * @return Controllers\TokensController The *Singleton* instance + */ + public function getTokens() + { + return Controllers\TokensController::getInstance(); } /** * Singleton access to Transactions controller diff --git a/tests/Controllers/ChargesControllerTest.php b/tests/Controllers/ChargesControllerTest.php new file mode 100644 index 0000000..a059f7e --- /dev/null +++ b/tests/Controllers/ChargesControllerTest.php @@ -0,0 +1,85 @@ +getCharges(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Lists all charges + */ + public function testTestGetCharges() + { + // Parameters for the API call + $page = null; + $size = null; + $code = null; + $status = null; + $paymentMethod = null; + $customerId = null; + $orderId = null; + $createdSince = null; + $createdUntil = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getCharges($page, $size, $code, $status, $paymentMethod, $customerId, $orderId, $createdSince, $createdUntil); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/CustomersControllerTest.php b/tests/Controllers/CustomersControllerTest.php new file mode 100644 index 0000000..c6aa440 --- /dev/null +++ b/tests/Controllers/CustomersControllerTest.php @@ -0,0 +1,81 @@ +getCustomers(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Get all Customers + */ + public function testTestGetCustomers() + { + // Parameters for the API call + $name = null; + $document = null; + $page = 1; + $size = 10; + $email = null; + $code = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getCustomers($name, $document, $page, $size, $email, $code); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/InvoicesControllerTest.php b/tests/Controllers/InvoicesControllerTest.php new file mode 100644 index 0000000..8206edf --- /dev/null +++ b/tests/Controllers/InvoicesControllerTest.php @@ -0,0 +1,87 @@ +getInvoices(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Gets all invoices + */ + public function testTestGetInvoices() + { + // Parameters for the API call + $page = null; + $size = null; + $code = null; + $customerId = null; + $subscriptionId = null; + $createdSince = null; + $createdUntil = null; + $status = null; + $dueSince = null; + $dueUntil = null; + $customerDocument = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getInvoices($page, $size, $code, $customerId, $subscriptionId, $createdSince, $createdUntil, $status, $dueSince, $dueUntil, $customerDocument); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/OrdersControllerTest.php b/tests/Controllers/OrdersControllerTest.php new file mode 100644 index 0000000..d4ab44a --- /dev/null +++ b/tests/Controllers/OrdersControllerTest.php @@ -0,0 +1,83 @@ +getOrders(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Gets all orders + */ + public function testTestGetOrders() + { + // Parameters for the API call + $page = null; + $size = null; + $code = null; + $status = null; + $createdSince = null; + $createdUntil = null; + $customerId = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getOrders($page, $size, $code, $status, $createdSince, $createdUntil, $customerId); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/PlansControllerTest.php b/tests/Controllers/PlansControllerTest.php new file mode 100644 index 0000000..f4d447c --- /dev/null +++ b/tests/Controllers/PlansControllerTest.php @@ -0,0 +1,83 @@ +getPlans(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Gets all plans + */ + public function testTestGetPlans() + { + // Parameters for the API call + $page = null; + $size = null; + $name = null; + $status = null; + $billingType = null; + $createdSince = null; + $createdUntil = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getPlans($page, $size, $name, $status, $billingType, $createdSince, $createdUntil); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/RecipientsControllerTest.php b/tests/Controllers/RecipientsControllerTest.php new file mode 100644 index 0000000..fde1909 --- /dev/null +++ b/tests/Controllers/RecipientsControllerTest.php @@ -0,0 +1,78 @@ +getRecipients(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Retrieves paginated recipients information + */ + public function testTestGetRecipients() + { + // Parameters for the API call + $page = null; + $size = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getRecipients($page, $size); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/SubscriptionsControllerTest.php b/tests/Controllers/SubscriptionsControllerTest.php new file mode 100644 index 0000000..74f49ea --- /dev/null +++ b/tests/Controllers/SubscriptionsControllerTest.php @@ -0,0 +1,88 @@ +getSubscriptions(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Gets all subscriptions + */ + public function testTestGetSubscriptions() + { + // Parameters for the API call + $page = null; + $size = null; + $code = null; + $billingType = null; + $customerId = null; + $planId = null; + $cardId = null; + $status = null; + $nextBillingSince = null; + $nextBillingUntil = null; + $createdSince = null; + $createdUntil = null; + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getSubscriptions($page, $size, $code, $billingType, $customerId, $planId, $cardId, $status, $nextBillingSince, $nextBillingUntil, $createdSince, $createdUntil); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/Controllers/TransfersControllerTest.php b/tests/Controllers/TransfersControllerTest.php new file mode 100644 index 0000000..a980861 --- /dev/null +++ b/tests/Controllers/TransfersControllerTest.php @@ -0,0 +1,74 @@ +getTransfers(); + } + + /** + * Setup test + */ + protected function setUp() + { + $this->httpResponse = new HttpCallBackCatcher(); + } + + /** + * Gets all transfers + */ + public function testTestGetTransfers1() + { + + // Set callback and perform API call + $result = null; + self::$controller->setHttpCallBack($this->httpResponse); + try { + $result = self::$controller->getTransfers1(); + } catch (APIException $e) { + } + + // Test response code + $this->assertEquals( + 200, + $this->httpResponse->getResponse()->getStatusCode(), + "Status is not 200" + ); + + // Test headers + $headers = []; + $headers['Content-Type'] = 'application/json' ; + + $this->assertTrue( + TestHelper::areHeadersProperSubsetOf($headers, $this->httpResponse->getResponse()->getHeaders(), true), + "Headers do not match" + ); + } +} diff --git a/tests/HttpCallBackCatcher.php b/tests/HttpCallBackCatcher.php new file mode 100644 index 0000000..2f3d413 --- /dev/null +++ b/tests/HttpCallBackCatcher.php @@ -0,0 +1,58 @@ +request = $httpContext->getRequest(); + $instance->response = $httpContext->getResponse(); + }); + } + + /** + * Get the HTTP Request object associated with this API call + * @return MundiAPILib\Http\HttpRequest + */ + public function getRequest() + { + return $this->request; + } + + /** + * Get the HTTP Response object associated with this API call + * @return MundiAPILib\Http\HttpResponse + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/tests/TestHelper.php b/tests/TestHelper.php new file mode 100644 index 0000000..f7e8774 --- /dev/null +++ b/tests/TestHelper.php @@ -0,0 +1,359 @@ + $eV) { + $found = false; + foreach (array_values($response) as $rK => $rV) { + if ($eV == $rV) + $found = true; + } + if ($found == false) { + throw new \Exception("Response array is missing values"); + } + } + } + + /** + * Recursively check whether the leftTree is a proper subset of the right tree + * @param array $leftTree Left tree + * @param array $rightTree Right tree + * @param boolean $checkValues Check primitive values for equality? + * @param boolean $allowExtra Are extra elements allowed in right array? + * @param boolean $isOrdered Should elements in right be compared in order to left? + * @return boolean True if leftTree is a subset of rightTree + */ + public static function isProperSubsetOf( + array $leftTree = null, + array $rightTree = null, + $checkValues, + $allowExtra, + $isOrdered + ) { + + if ($leftTree == null) { + return true; + } + + for ($iterator = new \ArrayIterator($leftTree); $iterator->valid(); $iterator->next()) { + $key = $iterator->key(); + $leftVal = $leftTree[$key]; + $rightVal = $rightTree[$key]; + + // Check if key exists + if (!array_key_exists($key, $rightTree)) { + return false; + } + if (static::isAssoc($leftVal)) { + // If left value is tree, right value should be be tree too + if (static::isAssoc($rightVal)) { + if (!static::isProperSubsetOf( + $leftVal, + $rightVal, + $checkValues, + $allowExtra, + $isOrdered + )) { + return false; + } + } else { + return false; + } + } else { + // Value comparison if checkValues + if ($checkValues) { + // If left value is a primitive, check if it equals right value + if (is_array($leftVal)) { + if (!is_array($rightVal)) { + return false; + } + if (count($leftVal) > 0 && static::isAssoc($leftVal[0])) { + if (!static::isArrayOfJsonObjectsProperSubsetOf( + $leftVal, + $rightVal, + $checkValues, + $allowExtra, + $isOrdered + )) { + return false; + } + } else { + if (!static::isListProperSubsetOf( + $leftVal, + $rightVal, + $allowExtra, + $isOrdered + )) { + return false; + } + } + } elseif (!$leftVal == $rightTree[$key] && !$leftVal == null) { + return false; + } + } + } + } + return true; + } + + /** + * Recursively check whether the left JSON object is a proper subset of the right JSON object + * @param array $leftObject Left JSON object as string + * @param array $rightObject Right JSON object as string + * @param boolean $checkValues Check primitive values for equality? + * @param boolean $allowExtra Are extra elements allowed in right array? + * @param boolean $isOrdered Should elements in right be compared in order to left? + * @return boolean If Json object is a subset + */ + public static function isJsonObjectProperSubsetOf( + $leftObject, + $rightObject, + $checkValues, + $allowExtra, + $isOrdered + ) { + + return static::isProperSubsetOf( + APIHelper::deserialize($leftObject), + APIHelper::deserialize($rightObject), + $checkValues, + $allowExtra, + $isOrdered + ); + } + + /** + * Check if left array of objects is a subset of right array + * @param array $leftObject Left array as a JSON string + * @param array $rightObject Right array as a JSON string + * @param boolean $checkValues Check primitive values for equality? + * @param boolean $allowExtra Are extra elements allowed in right array? + * @param boolean $isOrdered Should elements in right be compared in order to left? + * @return boolean True if it is a subset + */ + public static function isArrayOfStringifiedJsonObjectsProperSubsetOf( + $leftObject, + $rightObject, + $checkValues, + $allowExtra, + $isOrdered + ) { + + // Deserialize left and right objects from their respective strings + $left = APIHelper::deserialize($leftObject); + $right = APIHelper::deserialize($rightObject); + + return static::isArrayOfJsonObjectsProperSubsetOf( + $left, + $right, + $checkValues, + $allowExtra, + $isOrdered + ); + } + + /** + * Check if left array of objects is a subset of right array + * @param array $left Left array as a JSON string + * @param array $right Right array as a JSON string + * @param boolean $checkValues Check primitive values for equality? + * @param boolean $allowExtra Are extra elements allowed in right array? + * @param boolean $isOrdered Should elements in right be compared in order to left? + * @return boolean True if it is a subset + */ + public static function isArrayOfJsonObjectsProperSubsetOf( + $left, + $right, + $checkValues, + $allowExtra, + $isOrdered + ) { + + // Return false if size different and checking was strict + if (!$allowExtra && count($left) != count($right)) { + return false; + } + + // Create list iterators + $leftIter = (new \ArrayObject($left))->getIterator(); + $rightIter = (new \ArrayObject($right))->getIterator(); + + // Iterate left list and check if each value is present in the right list + while ($leftIter->valid()) { + $leftIter->next(); + $leftTree = $leftIter->current(); + $found = false; + + // If order is not required, then search right array from beginning + if (!$isOrdered) { + $rightIter->rewind(); + } + + // Check each right element to see if left is a subset + while ($rightIter->valid()) { + $rightIter->next(); + if (static::isProperSubsetOf( + $leftTree, + $rightIter->current(), + $checkValues, + $allowExtra, + $isOrdered + )) { + $found = true; + break; + } + } + + if (!$found) { + return false; + } + } + + return true; + } + + /** + * Check whether the a list is a subset of another list + * @param array $leftList Expected List + * @param array $rightList List to check + * @param boolean $allowExtra Are extras allowed in the list to check? + * @param boolean $isOrdered Should checking be in order? + * @return boolean True if leftList is a subset of rightList + */ + public static function isListProperSubsetOf( + array $leftList, + array $rightList, + $allowExtra, + $isOrdered + ) { + + if ($isOrdered && !$allowExtra) { + return $leftList === $rightList; + } elseif ($isOrdered && $allowExtra) { + return array_slice($rightList, 0, count($leftList)) === $leftList; + } elseif (!$isOrdered && !$allowExtra) { + return count($leftList) == count($rightList) && + array_intersect($leftList, $rightList) == $leftList; + } elseif (!$isOrdered && $allowExtra) { + return array_intersect($leftList, $rightList) == $leftList; + } + return true; + } + + /** + * Recursively check whether the left headers map is a proper subset of + * the right headers map. Header keys & values are compared case-insensitive. + * + * @param array $leftTree Left headers map + * @param array $rightTree Right headers map + * @param boolean $checkValues Check header values for equality? + * @return boolean True if leftTree is a subset of rightTree + */ + public static function areHeadersProperSubsetOf( + array $leftTree, + array $rightTree, + $checkValues + ) { + + // Http headers are case-insensitive + $l = array_change_key_case($leftTree); + $r = array_change_key_case($rightTree); + + return static::isProperSubsetOf($l, $r, $checkValues, true, false); + } + + /** + * Is array associative? + * @param mixed $array Input + * @return boolean True if associative array + */ + public static function isAssoc($array) + { + if (!is_array($array)) { + return false; + } + + // Keys of the array + $keys = array_keys($array); + + // If the array keys of the keys match the keys, then the array must + // not be associative (e.g. the keys array looked like {0:0, 1:1...}). + return array_keys($keys) !== $keys; + } + + /** + * Downloads and gets a local path to a file URL. + * Subsequent calls to the same URL will get the cached file. + * @param string $url URL of the file to download + * @return string Local path to the file + */ + public static function getFile($url) + { + $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "sdktests" . sha1($url) . "tmp"; + if (!file_exists($filename)) { + file_put_contents($filename, fopen($url, 'r')); + } + return $filename; + } + + /** + * Downloads and gets contents of a file URL. + * Subsequent calls to the same URL will get the cached file. + * @param string $url URL of the file to download + * @return binary File contents + */ + public static function getFileContents($url) + { + return file_get_contents(static::getFile($url)); + } + + /** + * Get a new JsonMapper instance for mapping objects + * @return \apimatic\jsonmapper\JsonMapper JsonMapper instance + */ + public static function getJsonMapper() + { + $mapper = new JsonMapper(); + $mapper->arChildClasses['MundiAPILib\\Models\\GetTransactionResponse'] = array( + 'MundiAPILib\\Models\\GetBankTransferTransactionResponse', + 'MundiAPILib\\Models\\GetDebitCardTransactionResponse', + 'MundiAPILib\\Models\\GetVoucherTransactionResponse', + 'MundiAPILib\\Models\\GetBoletoTransactionResponse', + 'MundiAPILib\\Models\\GetCashTransactionResponse', + 'MundiAPILib\\Models\\GetSafetyPayTransactionResponse', + 'MundiAPILib\\Models\\GetCreditCardTransactionResponse', + 'MundiAPILib\\Models\\GetPrivateLabelTransactionResponse', + 'MundiAPILib\\Models\\GetPixTransactionResponse' + ); + return $mapper; + } + +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..e305e94 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,15 @@ +