Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DraftPayment create fails with superfluous field-errors #101

Closed
BabyDino opened this issue Jan 3, 2018 · 1 comment
Closed

DraftPayment create fails with superfluous field-errors #101

BabyDino opened this issue Jan 3, 2018 · 1 comment

Comments

@BabyDino
Copy link
Contributor

BabyDino commented Jan 3, 2018

Steps to reproduce:

// Create pointer
$alias = new Pointer('IBAN', $iban);
$alias->setName($name);

// Create draft payment entry
$draftPaymentEntry = new DraftPaymentEntry(
	new Amount($amount, 'EUR'),
	$alias,
	"Description of draft payment"
);

// Set merchant reference
$draftPaymentEntry->setMerchantReference("Merch-ref-bla");

// Create a payment map.
$draftPaymentMap = [
	DraftPayment::FIELD_ENTRIES => [
		$draftPaymentEntry
	],
	DraftPayment::FIELD_NUMBER_OF_REQUIRED_ACCEPTS => 1 
];

// Create a new payment and retrieve it's id.
$draftPaymentId = DraftPayment::create($apiContext, $draftPaymentMap, BUNQ_USER_ID, BUNQ_TICKETS_ACCOUNT);

What should happen:

Return of the Payment ID

What happens:

HTTP Response Code: 400
Superfluous field "allow_bunqto".
Superfluous field "id".
Superfluous field "alias".
Superfluous field "type".

SDK version and environment

  • Tested on develop branch
  • Sandbox

Response id

  • Response id: 2e5227e7-3f79-4b41-b66b-53e51da5639e
@OGKevin
Copy link
Contributor

OGKevin commented Jan 5, 2018

Ahh, @BabyDino this is due to the following:

class DraftPaymentEntry extends BunqModel
is only supposed to be used for responses and not when making requests.

See #63 (comment)
In a future refactor this will be picked up.

Closing this issue for now as this is not a bug, but feel free to comment.

@OGKevin OGKevin closed this as completed Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants